Browse Source

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) <noreply@anthropic.com>
main
Aaron Parecki 1 day ago
parent
commit
9aa151f49f
1 changed files with 46 additions and 0 deletions
  1. +46
    -0
      .github/workflows/php.yml

+ 46
- 0
.github/workflows/php.yml View File

@ -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

Loading…
Cancel
Save