bug #10
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
# https://docs.github.com/en/actions/using-workflows/reusing-workflows | |
name: Checks | |
on: pull_request | |
jobs: | |
analyse: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: dependencies | |
uses: php-actions/composer@v6 | |
with: | |
php_version: 8.3 | |
php_extensions: bcmath | |
- name: install tools | |
run: | | |
mkdir --parents tools/phpstan tools/phpunit | |
composer require phpstan/phpstan --working-dir=tools/phpstan --no-interaction --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | |
composer require phpunit/phpunit --working-dir=tools/phpunit --no-interaction --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | |
- name: analyse | |
run: tools/phpstan/vendor/bin/phpstan --error-format=github --no-progress | |
cs: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: dependencies | |
uses: php-actions/composer@v6 | |
with: | |
php_version: 8.3 | |
php_extensions: zip gd bcmath | |
- name: install ecs | |
run: | | |
mkdir --parents tools/ecs tools/staabm | |
composer require easy-cs/easy-cs --working-dir=tools/ecs --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
composer require staabm/annotate-pull-request-from-checkstyle --working-dir=tools/staabm --no-interaction | |
- name: run checks | |
# run: tools/ecs/vendor/bin/ecs check --ansi --no-progress-bar | |
run: tools/ecs/vendor/bin/ecs check --ansi --no-progress-bar --output-format=checkstyle | tools/staabm/vendor/bin/cs2pr | |
- name: comment on failure | |
if: ${{ failure() && github.event_name == 'pull_request' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const body = '❌ Our coding standards were not met.\nplease run\n```shell\ncomposer fix-cs\n```\nsee ' + url; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) |