diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6a27f9b..5508528 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,35 +1,60 @@ name: tests -on: [ push, pull_request ] +on: + - push + - pull_request jobs: build: runs-on: ubuntu-latest + + strategy: + fail-fast: true + matrix: + php: [8.0, 8.1, 8.2, 8.3] + laravel: ['9.*', '10.*', '11.*'] + dependency-version: [prefer-lowest, prefer-stable] + exclude: + - laravel: 9.* + php: 8.2 + - laravel: 9.* + php: 8.3 + - laravel: 10.* + php: 8.0 + - laravel: 11.* + php: 8.0 + - laravel: 11.* + php: 8.1 + include: + - laravel: 9.* + testbench: 7.* + - laravel: 10.* + testbench: 8.* + - laravel: 11.* + testbench: 9.* + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} + steps: - name: Make chown run: sudo chown -R $USER:$USER ${{ github.workspace }} - - uses: actions/checkout@v2 + + - name: Checkout code + uses: actions/checkout@v2 + - name: Docker compose up run: docker-compose up -d - - name: Validate composer.json and composer.lock - run: composer validate - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 + + - name: Cache dependencies + uses: actions/cache@v2 with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + - name: Install dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest - - name: Run test suite - run: vendor/bin/phpunit --coverage-clover coverage.xml -# - uses: codecov/codecov-action@v1 -# with: -# file: ./coverage.xml -# flags: unittests -# fail_ci_if_error: true + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + + - name: Execute tests + run: vendor/bin/phpunit --testdox diff --git a/composer.json b/composer.json index 6235501..ec7ff0a 100644 --- a/composer.json +++ b/composer.json @@ -61,5 +61,5 @@ "sort-packages": true }, "minimum-stability": "dev", - "prefer-stable" : true + "prefer-stable": true }