From 62989c0f947839306435a1e1bc75639d5347b961 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Sat, 18 May 2024 17:09:46 +1000 Subject: [PATCH] Run test matrix --- .github/workflows/main.yml | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 055a2a4..68bd8d9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,3 +46,50 @@ jobs: - name: PHPStan run: phpstan + + tests: + runs-on: ubuntu-latest + name: 'PHP ${{ matrix.php }} Illuminate ${{ matrix.illuminate }}' + strategy: + matrix: + php: ['8.1', '8.2', '8.3'] + illuminate: ['10', '11'] + include: + - illuminate: '10' + testbench: '8' + - illuminate: '11' + testbench: '9' + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-php-${{ matrix.php }}-illuminate-${{ matrix.illuminate }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-phpunit-${{ matrix.illuminate }}-composer- + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Install dependencies + run: | + composer require --no-update \ + illuminate/http:^${{ matrix.illuminate }} \ + illuminate/support:^${{ matrix.illuminate }} \ + orchestra/testbench:^${{ matrix.testbench }} + composer update + + - name: Configure PHPUnit + run: "if [ -f './phpunit.${{ matrix.phpunit }}.xml' ]; then cp ./phpunit.${{ matrix.phpunit }}.xml ./phpunit.xml; fi" + + - name: PHPUnit + run: ./vendor/bin/phpunit --do-not-cache-result