Browse Source

Update the test workflow to match XRay's and run the integration tests

Test on PHP 7.2 through 8.4, up from 8.0, and update the checkout and
cache actions to v4. Key the cache on the PHP version and composer.json:
there's no committed composer.lock, so every matrix job was sharing one
vendor cache. Add a Redis service and run the integration suite too,
which the workflow never ran.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
main
Aaron Parecki 1 day ago
parent
commit
f6b1aa93fd
1 changed files with 25 additions and 8 deletions
  1. +25
    -8
      .github/workflows/php.yml

+ 25
- 8
.github/workflows/php.yml View File

@ -10,11 +10,24 @@ jobs:
build: build:
strategy: strategy:
matrix: matrix:
php-versions: ["7.2", "7.3", "7.4", "8.0"]
# The library supports PHP 5.5+, but PHPUnit 8.5 needs 7.2 or later
php-versions: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
runs-on: ubuntu-latest runs-on: ubuntu-latest
# The integration tests use Redis on 127.0.0.1:6379
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps: steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
@ -23,20 +36,24 @@ jobs:
extensions: mbstring, simplexml, dom, curl extensions: mbstring, simplexml, dom, curl
coverage: pcov coverage: pcov
- name: Validate composer.json and composer.lock
- name: Validate composer.json
run: composer validate --strict run: composer validate --strict
- name: Cache Composer packages - name: Cache Composer packages
id: composer-cache id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with: with:
path: vendor path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('composer.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-php-
${{ runner.os }}-php-${{ matrix.php-versions }}-
# There's no committed composer.lock, so resolve for each PHP version
- name: Install dependencies - name: Install dependencies
run: composer update --prefer-dist --no-progress run: composer update --prefer-dist --no-progress
- name: Run test suite
- name: Run unit tests
run: composer run-script test run: composer run-script test
- name: Run integration tests
run: vendor/bin/phpunit --testsuite integration

Loading…
Cancel
Save