60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
name: "QC: PHP"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
schedule:
|
|
- cron: "0 11 * * 2" # 11am Patch Tuesday
|
|
|
|
concurrency:
|
|
group: ${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
php-stan:
|
|
name: PHPStan
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
checks: write # To post annotations
|
|
contents: read # For repo checkout
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- id: read-php-version
|
|
run: echo "php_version=$(jq -r '.require["php"]' composer.json | sed -E 's/[^0-9.]//g')" >> $GITHUB_OUTPUT
|
|
- uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ steps.read-php-version.outputs.php_version }}
|
|
tools: phpstan
|
|
- id: composer-cache-find
|
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
- id: composer-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.composer-cache-find.outputs.dir }}
|
|
key: "${{ runner.os }}-bouncer-composer-${{ hashFiles('**/composer.lock') }}"
|
|
restore-keys: ${{ runner.os }}-bouncer-composer-
|
|
- run: composer install --ignore-platform-reqs --prefer-dist
|
|
- run: phpstan analyse src
|
|
|
|
php-cs-fixer:
|
|
name: PHP-CS-Fixer
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
checks: write # For trunk to post annotations
|
|
contents: read # For repo checkout
|
|
pull-requests: write # To create PRs
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- id: read-php-version
|
|
run: echo "php_version=$(jq -r '.require["php"]' composer.json | sed -E 's/[^0-9.]//g')" >> $GITHUB_OUTPUT
|
|
- uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ steps.read-php-version.outputs.php_version }}
|
|
tools: php-cs-fixer
|
|
- run: php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose --dry-run
|