Static Code Analysis #683
This file contains hidden or 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
name: Static Code Analysis | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
pull_request: | |
push: | |
branches: | |
- 1.x | |
paths: | |
- '**.php' | |
- .github/workflows/static-code-analysis.yml | |
- composer.json | |
- '**.neon' | |
concurrency: | |
group: sca-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- '8.3' | |
- '8.4' | |
name: Static Code Analysis | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
coverage: none | |
- name: Configure Composer to use HTTPS and GitHub token | |
run: | | |
composer config --global github-protocols https | |
composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} | |
- name: Get composer cache directory | |
id: cache-dir | |
run: | | |
echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.cache-dir.outputs.COMPOSER_CACHE_DIR }} | |
key: ${{ github.workflow }}-PHP_${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
${{ github.workflow }}-PHP_${{ matrix.php-version }}- | |
- name: Install dependencies | |
run: | | |
composer update --ansi | |
- name: Check - Composer validate | |
run: | | |
COMPONENTS=$( | |
find src/Nexus -mindepth 2 -type f -name composer.json \ | |
| cut -d '/' -f 1-3 \ | |
| sort -fh | |
) | |
echo "+ composer validate --strict --ansi" | |
composer validate --strict --ansi | |
echo "$COMPONENTS" | xargs -I {} bash -xc "composer validate --strict --ansi --working-dir {}" | |
- name: Check - Composer normalize | |
run: | | |
COMPONENTS=$( | |
find src/Nexus -mindepth 2 -type f -name composer.json \ | |
| cut -d '/' -f 1-3 \ | |
| sort -fh | |
) | |
echo "::group::composer normalize" | |
composer global config --ansi allow-plugins.ergebnis/composer-normalize true | |
composer global require --ansi ergebnis/composer-normalize | |
echo "::endgroup::" | |
echo "+ composer normalize --dry-run --diff --ansi" | |
composer normalize --dry-run --diff --ansi | |
echo "$COMPONENTS" | xargs -I {} bash -xc "composer normalize --dry-run --diff --ansi --working-dir {}" | |
- name: Check - file permissions | |
run: bin/check-file-permissions | |
- name: Check - Auto-Review | |
run: composer test:auto-review | |
env: | |
TACHYCARDIA_MONITOR_GA: enabled | |
- name: Check - Static Analysis | |
run: composer test:stan | |
env: | |
TACHYCARDIA_MONITOR_GA: enabled | |
- name: Check - PHP-CS-Fixer | |
run: composer cs:check | |
- name: Check - PHPStan | |
run: composer phpstan:check |