|
1 | 1 | name: "CI" |
2 | | -# Controls when the action will run. |
| 2 | + |
3 | 3 | on: |
4 | | - # Triggers the workflow on push or pull request events but only for the main branch |
5 | 4 | push: |
| 5 | + branches: |
| 6 | + - "main" |
6 | 7 | pull_request: |
7 | | - |
8 | | - # Allows you to run this workflow manually from the Actions tab |
| 8 | + branches: |
| 9 | + - "main" |
9 | 10 | workflow_dispatch: |
10 | 11 |
|
11 | 12 | permissions: |
12 | 13 | contents: "read" |
13 | 14 |
|
14 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 15 | +concurrency: |
| 16 | + group: "ci-${{ github.workflow }}-${{ github.ref }}" |
| 17 | + cancel-in-progress: true |
| 18 | + |
15 | 19 | jobs: |
16 | | - # composer validation |
17 | 20 | composer: |
18 | 21 | name: "composer config validation" |
19 | 22 | runs-on: "ubuntu-latest" |
| 23 | + timeout-minutes: 10 |
20 | 24 | steps: |
21 | | - - uses: "actions/checkout@v3" |
| 25 | + - name: "git checkout" |
| 26 | + uses: "actions/checkout@v4" |
22 | 27 | - name: "Validate composer.json" |
23 | 28 | run: "composer validate --strict" |
24 | | - # PHP lint and PHPStan for different PHP versions |
| 29 | + |
25 | 30 | php: |
| 31 | + name: "PHP ${{ matrix.php-version }}" |
| 32 | + needs: "composer" |
26 | 33 | runs-on: "ubuntu-latest" |
| 34 | + timeout-minutes: 15 |
27 | 35 | strategy: |
| 36 | + fail-fast: false |
28 | 37 | matrix: |
29 | 38 | php-version: |
30 | 39 | - "8.1" |
31 | 40 | - "8.2" |
32 | 41 | - "8.3" |
33 | | - name: "PHP ${{ matrix.php-version }}" |
34 | 42 | steps: |
35 | 43 | - name: "git checkout" |
36 | | - uses: "actions/checkout@v3" |
| 44 | + uses: "actions/checkout@v4" |
37 | 45 | - name: "setup PHP" |
38 | 46 | uses: "shivammathur/setup-php@v2" |
39 | 47 | with: |
40 | 48 | php-version: "${{ matrix.php-version }}" |
| 49 | + extensions: "json" |
41 | 50 | coverage: "xdebug" |
| 51 | + tools: "composer:v2" |
| 52 | + cache: "composer" |
42 | 53 | - name: "check PHP version" |
43 | 54 | run: "php -v" |
44 | 55 | - name: "lint PHP files" |
45 | | - run: "php -l src/" |
| 56 | + run: "find src -type f -name '*.php' -print0 | xargs -0 -n1 php -l" |
| 57 | + - name: "install composer dependencies" |
| 58 | + run: "composer install --prefer-dist --no-interaction --no-progress" |
| 59 | + |
| 60 | + phpstan: |
| 61 | + name: "PHPStan" |
| 62 | + needs: "composer" |
| 63 | + runs-on: "ubuntu-latest" |
| 64 | + timeout-minutes: 15 |
| 65 | + steps: |
| 66 | + - name: "git checkout" |
| 67 | + uses: "actions/checkout@v4" |
| 68 | + - name: "setup PHP" |
| 69 | + uses: "shivammathur/setup-php@v2" |
| 70 | + with: |
| 71 | + php-version: "8.3" |
| 72 | + extensions: "json" |
| 73 | + tools: "composer:v2" |
| 74 | + cache: "composer" |
46 | 75 | - name: "install composer dependencies" |
47 | | - run: "composer install --prefer-dist --no-progress" |
48 | | - # PHPStan |
| 76 | + run: "composer install --prefer-dist --no-interaction --no-progress" |
49 | 77 | - name: "PHPStan static analysis" |
50 | 78 | run: "vendor/bin/phpstan analyse --configuration=phpstan.neon" |
| 79 | + |
51 | 80 | codesniffer: |
| 81 | + name: "PHP CodeSniffer" |
| 82 | + needs: "composer" |
52 | 83 | runs-on: "ubuntu-latest" |
| 84 | + timeout-minutes: 15 |
53 | 85 | steps: |
54 | 86 | - name: "git checkout" |
55 | | - uses: "actions/checkout@v3" |
| 87 | + uses: "actions/checkout@v4" |
56 | 88 | - name: "setup PHP" |
57 | 89 | uses: "shivammathur/setup-php@v2" |
58 | 90 | with: |
59 | | - php-version: "8.1" |
| 91 | + php-version: "8.3" |
| 92 | + extensions: "json" |
| 93 | + tools: "composer:v2" |
| 94 | + cache: "composer" |
60 | 95 | - name: "install composer dependencies" |
61 | | - run: "composer install --prefer-dist --no-progress" |
| 96 | + run: "composer install --prefer-dist --no-interaction --no-progress" |
62 | 97 | - name: "check PHP_CodeSniffer version" |
63 | 98 | run: "vendor/bin/phpcs --version" |
64 | 99 | - name: "PHP CodeSniffer" |
|
0 commit comments