generated from yardinternet/skeleton-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 82185ff
Showing
31 changed files
with
12,061 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.php] | ||
indent_size = 4 | ||
|
||
[*.blade.php] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Basic set up for three package managers | ||
|
||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.) | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
reviewers: | ||
- yardinternet/wordpress-backend | ||
|
||
# Maintain dependencies for npm | ||
# - package-ecosystem: "npm" | ||
# directory: "/" | ||
# schedule: | ||
# interval: "weekly" | ||
# reviewers: | ||
# - yardinternet/wordpress-frontend | ||
|
||
# Maintain dependencies for Composer | ||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
reviewers: | ||
- yardinternet/wordpress-backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Add 'root' label to any root file changes | ||
# Quotation marks are required for the leading asterisk | ||
root: | ||
- changed-files: | ||
- any-glob-to-any-file: '*' | ||
|
||
# Add 'documentation' label to any change to .md files within the entire repository | ||
documentation: | ||
- changed-files: | ||
- any-glob-to-any-file: '**/*.md' | ||
|
||
# Add 'enhancement' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name | ||
enhancement: | ||
- head-branch: ['^feature', 'feature', '^feat'] | ||
|
||
# Add 'fix' label to any PR where the head branch name starts with `fix` or has a `fix` section in the name | ||
bug: | ||
- head-branch: ['fix', '^fix'] | ||
|
||
# Add 'release' label to any PR that is opened against the `main` branch | ||
release: | ||
- base-branch: 'main' | ||
|
||
# Add 'dependencies' label to any composer.lock or package-lock.json changes | ||
dependencies: | ||
- changed-files: | ||
- any-glob-to-any-file: ['composer.lock', 'package-lock.json'] | ||
|
||
# Add 'tests' label to any changes to the tests directory | ||
tests: | ||
- changed-files: | ||
- any-glob-to-any-file: 'tests/**/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Create badges | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
badges: | ||
name: Create badges | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: '8.1' | ||
extensions: simplexml, dom, xml, xdebug, intl | ||
tools: composer:v2 | ||
env: | ||
COMPOSER_TOKEN: ${{ secrets.YARD_BOT_PAT }} | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist | ||
|
||
- name: Recreate autoload file | ||
run: composer dump-autoload | ||
|
||
- name: Run Unit Tests | ||
run: XDEBUG_MODE_COVERAGE=coverage vendor/bin/pest --coverage-clover=clover.xml | ||
|
||
- name: Make lines of code badge | ||
uses: DeathSy/[email protected] | ||
id: badge | ||
with: | ||
debug: true | ||
directory: ./src | ||
patterns: '**/*.php' | ||
badge: ./output/lines-of-code.svg | ||
|
||
- name: Make code coverage badge | ||
uses: timkrase/[email protected] | ||
with: | ||
coverage_badge_path: output/coverage.svg | ||
push_badge: false | ||
|
||
- name: Git push to badges branch | ||
uses: peaceiris/actions-gh-pages@v4 | ||
with: | ||
publish_dir: ./output | ||
publish_branch: badges | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Composer Diff | ||
on: | ||
pull_request: | ||
paths: | ||
- 'composer.lock' | ||
jobs: | ||
composer-diff: | ||
name: Composer Diff | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Required to make it possible to compare with PR base branch | ||
|
||
- name: Generate composer diff | ||
id: composer_diff # To reference the output in comment | ||
uses: IonBazan/composer-diff-action@v1 | ||
|
||
- uses: marocchino/sticky-pull-request-comment@v2 | ||
# An empty diff result will break this action. | ||
if: ${{ steps.composer_diff.outputs.composer_diff_exit_code != 0 }} | ||
with: | ||
header: composer-diff # Creates a collapsed comment with the report | ||
message: | | ||
<details> | ||
<summary>Composer package changes</summary> | ||
${{ steps.composer_diff.outputs.composer_diff }} | ||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Code Style | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**.php' | ||
|
||
jobs: | ||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
|
||
- name: Run php-cs-fixer | ||
uses: docker://oskarstark/php-cs-fixer-ga | ||
|
||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: '(auto): apply php-cs-fixer changes' | ||
push_options: '--force' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.YARD_BOT_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: 'Labeler' | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
label: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Labeler | ||
uses: actions/[email protected] | ||
with: | ||
repo-token: '${{ secrets.GITHUB_TOKEN }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: NPM Lockfile Changes | ||
on: | ||
pull_request: | ||
paths: | ||
- 'package-lock.json' | ||
|
||
jobs: | ||
lockfile_changes: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Required to make it possible to compare with PR base branch | ||
- name: NPM Lockfile Changes | ||
uses: codepunkt/npm-lockfile-changes@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: PHPStan | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**.php' | ||
- 'phpstan.neon.dist' | ||
- '.github/workflows/phpstan.yml' | ||
|
||
jobs: | ||
phpstan: | ||
name: phpstan | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
tools: composer:v2 | ||
coverage: none | ||
env: | ||
COMPOSER_TOKEN: ${{ secrets.YARD_BOT_PAT }} | ||
|
||
- name: Install composer dependencies | ||
run: composer install --prefer-dist --no-interaction | ||
|
||
- name: Dirty fix for previously defined function | ||
run: sed -i -e 's#function __(#function ____(#' ./vendor/php-stubs/wordpress-stubs/wordpress-stubs.php | ||
|
||
- name: Run PHPStan | ||
run: ./vendor/bin/phpstan --error-format=github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**.php' | ||
- '.github/workflows/run-tests.yml' | ||
- 'phpunit.xml.dist' | ||
- 'composer.json' | ||
- 'composer.lock' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
php: [8.1, 8.2] | ||
laravel: [10.*] | ||
include: | ||
- laravel: 10.* | ||
testbench: 8.* | ||
|
||
name: PHP${{ matrix.php }} - Laravel${{ matrix.laravel }} | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, xdebug | ||
coverage: xdebug | ||
tools: composer:v2 | ||
env: | ||
COMPOSER_TOKEN: ${{ secrets.YARD_BOT_PAT }} | ||
|
||
- name: Setup problem matchers | ||
run: | | ||
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
- name: Install dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update | ||
composer update --prefer-dist --no-interaction | ||
- name: List Installed Dependencies | ||
run: composer show -D | ||
|
||
- name: Execute tests | ||
run: vendor/bin/pest --coverage-clover=coverage.xml | ||
|
||
- name: Coverage Report as Comment (Clover) | ||
if: github.event_name == 'pull_request' | ||
uses: lucassabreu/comment-coverage-clover@main | ||
with: | ||
file: coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.phpunit.cache | ||
.php-cs-fixer.cache | ||
vendor | ||
node_modules | ||
build |
Oops, something went wrong.