|
| 1 | +--- |
| 2 | +name: PHP Quality Assistance |
| 3 | + |
| 4 | +on: |
| 5 | + # This event occurs when there is activity on a pull request. The workflow |
| 6 | + # will be run against the commits, after merge to the target branch (main). |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - '**.php' |
| 10 | + - '.config/phpcs.xml.dist' |
| 11 | + - '.config/phpunit.xml.dist' |
| 12 | + - '.github/workflows/php.yml' |
| 13 | + - 'composer.json' |
| 14 | + - 'composer.lock' |
| 15 | + branches: [ main ] |
| 16 | + types: [ opened, reopened, synchronize ] |
| 17 | + # This event occurs when there is a push to the repository. |
| 18 | + push: |
| 19 | + paths: |
| 20 | + - '**.php' |
| 21 | + - '.config/phpcs.xml.dist' |
| 22 | + - '.config/phpunit.xml.dist' |
| 23 | + - '.github/workflows/php.yml' |
| 24 | + - 'composer.json' |
| 25 | + - 'composer.lock' |
| 26 | + # Allow manually triggering the workflow. |
| 27 | + workflow_dispatch: |
| 28 | + |
| 29 | + |
| 30 | +# Cancels all previous workflow runs for the same branch that have not yet completed. |
| 31 | +concurrency: |
| 32 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +permissions: |
| 36 | + # Needed to allow the "concurrency" section to cancel a workflow run. |
| 37 | + actions: write |
| 38 | + |
| 39 | +jobs: |
| 40 | + # 01.preflight.php.lint-syntax.yml |
| 41 | + lint-php-syntax: |
| 42 | + name: PHP Syntax Linting |
| 43 | + runs-on: ubuntu-24.04 |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - uses: docker://pipelinecomponents/php-linter |
| 47 | + with: |
| 48 | + args: >- |
| 49 | + parallel-lint |
| 50 | + --exclude .git |
| 51 | + --exclude vendor |
| 52 | + --no-progress |
| 53 | + . |
| 54 | + # 01.quality.php.validate.dependencies-file.yml |
| 55 | + validate-dependencies-file: |
| 56 | + name: Validate dependencies file |
| 57 | + runs-on: ubuntu-24.04 |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + - run: >- |
| 61 | + composer validate |
| 62 | + --check-lock |
| 63 | + --no-plugins |
| 64 | + --no-scripts |
| 65 | + --strict |
| 66 | + # 03.quality.php.scan.dependencies-vulnerabilities.yml |
| 67 | + scan-dependencies-vulnerabilities: |
| 68 | + name: Scan Dependencies Vulnerabilities |
| 69 | + needs: |
| 70 | + - validate-dependencies-file |
| 71 | + runs-on: ubuntu-24.04 |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v4 |
| 74 | + - run: >- |
| 75 | + composer audit |
| 76 | + --abandoned=report |
| 77 | + --locked |
| 78 | + --no-dev |
| 79 | + --no-plugins |
| 80 | + --no-scripts |
| 81 | + # 03.quality.php.lint-version-compatibility.yml |
| 82 | + php-check-version-compatibility: |
| 83 | + name: PHP Version Compatibility |
| 84 | + needs: |
| 85 | + - lint-php-syntax |
| 86 | + runs-on: ubuntu-24.04 |
| 87 | + strategy: |
| 88 | + fail-fast: false |
| 89 | + matrix: |
| 90 | + php: |
| 91 | + - '8.0' # from 2020-11 to 2022-11 (2023-11) |
| 92 | + - '8.1' # from 2021-11 to 2023-11 (2025-12) |
| 93 | + - '8.2' # from 2022-12 to 2024-12 (2026-12) |
| 94 | + - '8.3' # from 2023-11 to 2025-12 (2027-12) |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@v4 |
| 97 | + - uses: docker://pipelinecomponents/php-codesniffer |
| 98 | + with: |
| 99 | + args: >- |
| 100 | + phpcs |
| 101 | + -s |
| 102 | + --extensions=php |
| 103 | + --ignore='*vendor/*' |
| 104 | + --runtime-set testVersion ${{ matrix.php }} |
| 105 | + --standard=PHPCompatibility |
| 106 | + . |
0 commit comments