Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@ permissions:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php:
Comment thread
shadowhand marked this conversation as resolved.
Comment thread
shadowhand marked this conversation as resolved.
Comment thread
shadowhand marked this conversation as resolved.
- version: '8.5'
Comment thread
shadowhand marked this conversation as resolved.
Comment thread
shadowhand marked this conversation as resolved.
deps: latest
- version: '8.4'
deps: latest
- version: '8.4'
deps: lowest

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Get required PHP version
id: php-version
run: |
version=$(jq -r '.require.php' composer.json | sed -E 's/^[^0-9]*([0-9]+\.[0-9]+).*/\1/')
if ! echo "$version" | grep -qE '^[0-9]+\.[0-9]+$'; then
echo "::error::Could not determine PHP version from require.php in composer.json"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"

- name: Set up PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ steps.php-version.outputs.version }}
php-version: ${{ matrix.php.version }}
coverage: pcov

- name: Validate composer
Expand All @@ -45,14 +44,17 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
key: ${{ runner.os }}-composer-${{ matrix.php.deps }}-${{ matrix.php.version }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php.deps }}-${{ matrix.php.version }}-

- name: Install dependencies
Comment thread
shadowhand marked this conversation as resolved.
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_PRIVATE_ACCESS || github.token }}"}}'
if: matrix.php.deps == 'latest'
run: composer install --no-interaction --no-progress --prefer-dist

- name: Install dependencies (lowest versions)
if: matrix.php.deps == 'lowest'
run: composer update --no-interaction --no-progress --prefer-dist --prefer-lowest

- name: Check
run: composer run check

Expand All @@ -63,4 +65,11 @@ jobs:
run: composer run analyze

- name: Test
if: matrix.php.deps == 'latest'
run: composer run test

# In lowest version testing, there may be deprecations and we cannot be sure that code coverage works.
# Since we know that latest tests pass with coverage, we can ignore deprecations and skip the coverage check.
- name: Test (lowest versions)
if: matrix.php.deps == 'lowest'
run: composer run phpunit -- --do-not-fail-on-indirect-deprecation
Comment thread
shadowhand marked this conversation as resolved.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"require": {
"php": "^8.4",
"composer-runtime-api": "^2.0",
"php-standard-library/dict": "^6.3",
"php-standard-library/dict": "^6.0",
Comment thread
shadowhand marked this conversation as resolved.
"php-standard-library/filesystem": "^6.0",
"php-standard-library/json": "^6.3",
"php-standard-library/json": "^6.0",
Comment thread
shadowhand marked this conversation as resolved.
"php-standard-library/str": "^6.0",
"php-standard-library/vec": "^6.3",
"php-standard-library/vec": "^6.0",
Comment thread
shadowhand marked this conversation as resolved.
"psr/http-factory": "^1.0",
"psr/http-server-middleware": "^1.0",
"psr/log": "^2.0 || ^3.0"
Expand Down Expand Up @@ -76,7 +76,7 @@
],
"format": "mago format",
"lint": "mago lint",
"phpunit": "phpunit -d memory_limit=4G",
"phpunit": "phpunit",
Comment thread
shadowhand marked this conversation as resolved.
"test": [
"@phpunit",
"@coverage"
Expand Down
Loading