|
1 | | -name: PHP Composer |
| 1 | +name: Atlas.Pdo CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ "2.x" ] |
| 5 | + paths-ignore: |
| 6 | + - '**.md' |
| 7 | + - '**.txt' |
6 | 8 | pull_request: |
7 | | - branches: [ "2.x" ] |
| 9 | + paths-ignore: |
| 10 | + - '**.md' |
| 11 | + - '**.txt' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +env: |
| 15 | + fail-fast: true |
| 16 | + |
| 17 | + # PHP extensions required by Composer |
| 18 | + EXTENSIONS: pdo |
8 | 19 |
|
9 | 20 | permissions: |
10 | 21 | contents: read |
11 | 22 |
|
12 | 23 | jobs: |
13 | | - build: |
14 | 24 |
|
15 | | - runs-on: ubuntu-latest |
| 25 | + # PHPStan |
| 26 | + quality: |
| 27 | + name: "Validate Quality" |
| 28 | + if: "!contains(github.event.head_commit.message, 'ci skip')" |
| 29 | + |
| 30 | + permissions: |
| 31 | + contents: read |
16 | 32 |
|
| 33 | + runs-on: ubuntu-22.04 |
| 34 | + |
| 35 | + strategy: |
| 36 | + fail-fast: true |
| 37 | + matrix: |
| 38 | + php: |
| 39 | + - '8.1' |
| 40 | + - '8.2' |
| 41 | + - '8.3' |
| 42 | + - '8.4' |
17 | 43 | steps: |
18 | | - - uses: actions/checkout@v4 |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: "Setup PHP" |
| 47 | + uses: shivammathur/[email protected] |
| 48 | + with: |
| 49 | + php-version: ${{ matrix.php }} |
| 50 | + extensions: ${{ env.EXTENSIONS }} |
| 51 | + env: |
| 52 | + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
19 | 53 |
|
20 | | - - name: Validate composer.json and composer.lock |
21 | | - run: composer validate --strict |
| 54 | + - name: "Install development dependencies with Composer" |
| 55 | + uses: "ramsey/composer-install@v3" |
| 56 | + with: |
| 57 | + composer-options: "--prefer-dist" |
22 | 58 |
|
23 | | - - name: Cache Composer packages |
24 | | - id: composer-cache |
25 | | - uses: actions/cache@v3 |
26 | | - with: |
27 | | - path: vendor |
28 | | - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} |
29 | | - restore-keys: | |
30 | | - ${{ runner.os }}-php- |
| 59 | + - name: "PHPStan" |
| 60 | + run: | |
| 61 | + composer stan |
31 | 62 |
|
32 | | - - name: Install dependencies |
33 | | - run: composer install --prefer-dist --no-progress |
| 63 | + unit-tests: |
| 64 | + needs: quality |
| 65 | + |
| 66 | + permissions: |
| 67 | + contents: read # to fetch code (actions/checkout) |
| 68 | + |
| 69 | + name: Unit tests / PHP-${{ matrix.php }} |
| 70 | + runs-on: ubuntu-22.04 |
| 71 | + |
| 72 | + strategy: |
| 73 | + matrix: |
| 74 | + php: |
| 75 | + - '8.1' |
| 76 | + - '8.2' |
| 77 | + - '8.3' |
| 78 | + - '8.4' |
| 79 | + steps: |
| 80 | + - name: "Setup PHP" |
| 81 | + uses: shivammathur/[email protected] |
| 82 | + with: |
| 83 | + php-version: ${{ matrix.php }} |
| 84 | + extensions: ${{ env.EXTENSIONS }} |
| 85 | + env: |
| 86 | + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
34 | 87 |
|
35 | | - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" |
36 | | - # Docs: https://getcomposer.org/doc/articles/scripts.md |
| 88 | + - name: "Install development dependencies with Composer" |
| 89 | + uses: "ramsey/composer-install@v3" |
| 90 | + with: |
| 91 | + composer-options: "--prefer-dist" |
37 | 92 |
|
38 | | - # - name: Run test suite |
39 | | - # run: composer run-script test |
| 93 | + - name: "Run Unit Tests" |
| 94 | + if: always() |
| 95 | + run: | |
| 96 | + composer test |
0 commit comments