From 0e86ceba33aa7c2355c70cc8aa39c6696e8bde74 Mon Sep 17 00:00:00 2001 From: PresentKim Date: Wed, 7 Oct 2026 06:20:36 +0000 Subject: [PATCH 1/2] ci: Run tests on every pull request across PHP 7.1 to 8.4 - Run PHPUnit and lint on PHP 7.1 - 8.4 - Check that the generated traits are up to date --- .github/workflows/test.yml | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/test.yml 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 From 9e9fa68b4ed7e772977693d72a8bddff1008e521 Mon Sep 17 00:00:00 2001 From: PresentKim Date: Wed, 7 Oct 2026 06:21:38 +0000 Subject: [PATCH 2/2] ci: Allow PHPUnit 8.5 so PHP 7.2 can install dependencies PHPUnit 9 requires PHP 7.3 and Composer resolved only PHPUnit 9 on PHP 7.2 ("^7.5 || ^9.5"), so dependency installation failed there. Adding ^8.5 gives PHP 7.2 an installable PHPUnit. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",