Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore): workflows form boilerplate #7

Merged
merged 4 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ indent_size = 2
[*.md]
trim_trailing_whitespace = false
indent_style = space

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
32 changes: 0 additions & 32 deletions .github/labeler.yml

This file was deleted.

30 changes: 3 additions & 27 deletions .github/workflows/composer-lock-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,8 @@ 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>
uses: yardinternet/workflows/.github/workflows/composer-lock-diff.yml@main
secrets: inherit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull Request Workflow
name: Dependabot automerge
on: pull_request

jobs:
Expand Down
31 changes: 2 additions & 29 deletions .github/workflows/format-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,5 @@ on:

jobs:
php-cs-fixer:
name: php-cs-fixer
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: Run PHPStan
run: ./vendor/bin/php-cs-fixer fix

- 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 }}
uses: yardinternet/workflows/.github/workflows/format-php.yml@main
secrets: inherit
20 changes: 0 additions & 20 deletions .github/workflows/labeler.yml

This file was deleted.

15 changes: 3 additions & 12 deletions .github/workflows/markdown-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ on:
- '**.md'

jobs:
lint:
name: Markdown Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: DavidAnson/markdownlint-cli2-action@v18
with:
globs: |
*.md
config: .markdownlint.yml
linting:
uses: yardinternet/workflows/.github/workflows/markdown-linting.yml@main
secrets: inherit
15 changes: 2 additions & 13 deletions .github/workflows/npm-lock-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,5 @@ on:

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: rvanvelzen/npm-lockfile-changes@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
uses: yardinternet/workflows/.github/workflows/npm-lock-diff.yml@main
secrets: inherit
26 changes: 3 additions & 23 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ on:
- '.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: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
phpstan:
uses: yardinternet/workflows/.github/workflows/phpstan.yml@main
secrets: inherit
51 changes: 42 additions & 9 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,55 @@ on:
workflow_dispatch:

jobs:
ci:
runs-on: ubuntu-latest
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.1,8.2 ]

name: PHP${{ matrix.php }}

permissions:
contents: read
pull-requests: write

steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
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: Install Dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Tests
run: ./vendor/bin/pest --ci
- name: Install dependencies
run: |
composer require --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
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
},
"platform": {
"php": "8.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
},
"require": {
"php": "8.1.*",
"php": ">=8.1",
"ckr/arraymerger": "^3.0",
"webmozart/assert": "^1.11"
},
Expand Down