|
1 | 1 | name: Run Unit Tests |
2 | 2 |
|
3 | | -on: pull_request |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
4 | 8 |
|
5 | 9 | jobs: |
6 | 10 | build: |
7 | 11 | runs-on: ubuntu-latest |
| 12 | + # These permissions are needed to interact with GitHub's OIDC Token endpoint. |
| 13 | + permissions: |
| 14 | + id-token: write |
| 15 | + contents: read |
8 | 16 |
|
9 | 17 | strategy: |
10 | 18 | fail-fast: false |
11 | 19 | matrix: |
12 | | - php: [ 8.0, 8.1, 8.2, 8.3, 8.4 ] |
13 | | - laravel: [ 9.*, 10.*, 11.*, 12.* ] |
14 | | - dependency-version: [ prefer-lowest, prefer-stable ] |
| 20 | + php: [8.2, 8.3, 8.4] |
| 21 | + laravel: [10.*, 11.*, 12.*] |
| 22 | + dependency-version: [prefer-lowest, prefer-stable] |
15 | 23 | exclude: |
16 | | - - laravel: 9.* |
17 | | - php: 8.3 |
18 | | - - laravel: 9.* |
19 | | - php: 8.4 |
20 | | - - laravel: 10.* |
21 | | - php: 8.0 |
22 | 24 | - laravel: 10.* |
23 | 25 | php: 8.4 |
24 | | - - laravel: 11.* |
25 | | - php: 8.0 |
26 | | - - laravel: 11.* |
27 | | - php: 8.1 |
28 | 26 | - laravel: 11.* |
29 | 27 | php: 8.4 |
30 | | - - laravel: 12.* |
31 | | - php: 8.0 |
32 | | - - laravel: 12.* |
33 | | - php: 8.1 |
34 | 28 |
|
35 | 29 | name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} |
36 | 30 |
|
37 | 31 | steps: |
38 | 32 | - name: Checkout |
39 | 33 | uses: actions/checkout@v4 |
40 | 34 |
|
| 35 | + - name: Configure AWS credentials |
| 36 | + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' |
| 37 | + uses: aws-actions/configure-aws-credentials@v4 |
| 38 | + with: |
| 39 | + role-to-assume: ${{ vars.AWS_ASSUME_ROLE }} |
| 40 | + aws-region: ${{ secrets.AWS_REGION }} |
| 41 | + |
41 | 42 | - name: Setup PHP |
42 | 43 | uses: shivammathur/setup-php@v2 |
43 | 44 | with: |
|
60 | 61 | run: | |
61 | 62 | composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update |
62 | 63 | composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction |
63 | | -
|
| 64 | + |
64 | 65 | - name: Run PHPUnit tests |
65 | | - run: vendor/bin/phpunit --testsuite Unit |
| 66 | + if: github.event_name == 'pull_request' |
| 67 | + run: composer test:unit |
| 68 | + |
| 69 | + - name: Run PHPUnit tests |
| 70 | + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' |
| 71 | + run: composer test |
| 72 | + |
0 commit comments