diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..cab1bfa --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,43 @@ +name: Unit tests + +on: + push: + branches: [main] + pull_request: + +jobs: + phpunit: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: ['8.2', '8.3', '8.4'] + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: composer:v2 + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + + - name: Cache Composer packages + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ matrix.php }}-${{ hashFiles('composer.json') }} + restore-keys: composer-${{ matrix.php }}- + + - name: Install dependencies + run: composer install --no-interaction --no-progress --prefer-dist + + - name: Run unit tests + run: vendor/bin/phpunit --testsuite Unit