Code Style #199
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
name: "Code Style" | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: null | |
schedule: | |
# Do not make it the first of the month and/or midnight since it is a very busy time | |
- cron: "* 10 5 * *" | |
jobs: | |
php-cs-fixer: | |
runs-on: "ubuntu-latest" | |
name: "PHP-CS-Fixer ${{ matrix.php }}" | |
strategy: | |
fail-fast: true | |
matrix: | |
php: | |
- "8.1" | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
- name: "Setup PHP" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: "${{ matrix.php }}" | |
tools: "composer" | |
- name: "Install Composer dependencies" | |
uses: "ramsey/composer-install@v2" | |
- name: "Install PHP-CS-Fixer Composer dependencies" | |
if: "! matrix.skip_static_checks" | |
uses: "ramsey/composer-install@v2" | |
with: | |
working-directory: "vendor-bin/php-cs-fixer" | |
- name: "Lints CS" | |
run: "make cs_lint" | |
# This is a "trick", a meta task which does not change, and we can use in | |
# the protected branch rules as opposed to the individual tests which | |
# may change regularly. | |
validate-tests: | |
name: Code Style Status | |
runs-on: ubuntu-latest | |
needs: | |
- php-cs-fixer | |
if: always() | |
steps: | |
- name: Successful run | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing run | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |