diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3eabd19 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,49 @@ +name: Tests + +on: + pull_request: + workflow_dispatch: + +jobs: + phpunit: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: none + + # phpbench (benchmarks only) does not support the oldest PHP versions + - name: Remove benchmark dependency + run: composer remove --dev phpbench/phpbench --no-update --no-interaction + + - name: Install dependencies + run: composer update --prefer-dist --no-progress --no-interaction + + - name: Lint + run: find src tests/unit -name '*.php' -print0 | xargs -0 -n1 php -l + + - name: Run tests + run: composer test + + traits: + name: Generated traits are up to date + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check traits + run: python3 tools/generate-traits.py --check diff --git a/composer.json b/composer.json index 1ef17da..835489a 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "phpbench/phpbench": "^1.0", "ext-libxml": "*", "ext-simplexml": "*", - "phpunit/phpunit": "^7.5 || ^9.5" + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5" }, "license": "MIT", "version": "4.2.0",