From 9aa151f49fbc368fe03af9d23777c80b8005d09b Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 3 Oct 2026 14:22:56 +0000 Subject: [PATCH] Run the test suite on GitHub Actions across PHP versions Adapted from XRay's workflow. Tests run on PHP 7.3 through 8.4: the library supports 7.1+, but PHPUnit 9.6 needs 7.3. There's no committed composer.lock, so dependencies are resolved per PHP version and the cache is keyed on composer.json. ext-sockets is enabled so the resolver test covers hosts-file IPv6 lookups. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/php.yml | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..c6bf943 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,46 @@ +name: PHP Composer + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + strategy: + matrix: + # The library supports PHP 7.1+, but PHPUnit 9.6 needs 7.3 or later + php-versions: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + # sockets lets the resolver read IPv6 entries from the hosts file + extensions: mbstring, dom, curl, sockets + coverage: pcov + + # Not --strict: the open-ended mf2/mf2 constraint is only a warning + - name: Validate composer.json + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v4 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('composer.json') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php-versions }}- + + # There's no committed composer.lock, so resolve for each PHP version + - name: Install dependencies + run: composer update --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test