Skip to content

Commit d3869f3

Browse files
committed
ci: centralize test matrix, add Laravel 13, simplify PHP versions
- Define the PHP/Laravel/stability matrix once in tests.yml and pass it as JSON to all reusable workflows via fromJSON() - Add Laravel 13 (PHP ^8.3) to the test matrix - Only test oldest and newest PHP per Laravel version: L10: 8.1+8.4, L11: 8.2+8.4, L12: 8.2+8.4, L13: 8.3+8.4 - MariaDB workflow filters incompatible combos (L11 requires 10.10+) - Bump actions/checkout v3 → v4 - Bump stefanzweifel/git-auto-commit-action v4 → v7 - Bump aglipanci/laravel-pint-action 2.1.0 → 2.6 - Bump ramsey/composer-install v2 → v3 Closes tpetry#36
1 parent 264af20 commit d3869f3

8 files changed

Lines changed: 156 additions & 78 deletions

File tree

.github/workflows/code-style.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jobs:
88

99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
with:
1313
ref: ${{ github.head_ref }}
1414

1515
- name: Fix PHP code style issues
16-
uses: aglipanci/laravel-pint-action@2.1.0
16+
uses: aglipanci/laravel-pint-action@2.6
1717

1818
- name: Commit changes
19-
uses: stefanzweifel/git-auto-commit-action@v4
19+
uses: stefanzweifel/git-auto-commit-action@v7
2020
with:
2121
commit_message: Fix styling

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: phpstan
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111

1212
- name: Setup PHP
1313
uses: shivammathur/setup-php@v2
@@ -16,7 +16,7 @@ jobs:
1616
coverage: none
1717

1818
- name: Install composer dependencies
19-
uses: ramsey/composer-install@v2
19+
uses: ramsey/composer-install@v3
2020

2121
- name: Run PHPStan
2222
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/tests-maria.yml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,44 @@ on:
66
version:
77
required: true
88
type: string
9+
matrix:
10+
required: true
11+
type: string
912

1013
jobs:
14+
filter:
15+
name: Filter Matrix
16+
runs-on: ubuntu-latest
17+
outputs:
18+
matrix: ${{ steps.filter.outputs.matrix }}
19+
steps:
20+
- name: Filter incompatible combinations
21+
id: filter
22+
env:
23+
MATRIX: ${{ inputs.matrix }}
24+
VERSION: ${{ inputs.version }}
25+
run: |
26+
IFS='.' read -r major minor <<< "$VERSION"
27+
# Laravel 11.x requires MariaDB 10.10+
28+
if [[ $major -eq 10 && $minor -lt 10 ]]; then
29+
echo "matrix=$(echo "$MATRIX" | jq -c '[.[] | select(.laravel != "11.*")]')" >> "$GITHUB_OUTPUT"
30+
else
31+
echo "matrix=$(echo "$MATRIX" | jq -c .)" >> "$GITHUB_OUTPUT"
32+
fi
33+
1134
test:
1235
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
36+
needs: filter
1337

1438
runs-on: ubuntu-latest
1539
strategy:
1640
fail-fast: false
1741
matrix:
18-
version: ["${{ inputs.version }}"]
19-
php: [8.1, 8.2, 8.3, 8.4]
20-
laravel: [10.*, 11.*, 12.*]
21-
stability: [prefer-lowest, prefer-stable]
22-
exclude:
23-
# Laravel 12.x only supports PHP ^8.2
24-
- laravel: 12.*
25-
php: 8.1
26-
# Laravel 11.x only supports PHP ^8.2
27-
- laravel: 11.*
28-
php: 8.1
29-
# Laravel 11.x required MariaDB 10.10+
30-
- laravel: 11.*
31-
version: 10.3
32-
- laravel: 11.*
33-
version: 10.4
34-
- laravel: 11.*
35-
version: 10.5
36-
- laravel: 11.*
37-
version: 10.6
38-
- laravel: 11.*
39-
version: 10.7
40-
- laravel: 11.*
41-
version: 10.8
42-
- laravel: 11.*
43-
version: 10.9
42+
include: ${{ fromJSON(needs.filter.outputs.matrix) }}
4443

4544
services:
4645
database:
47-
image: mariadb:${{ matrix.version }}
46+
image: mariadb:${{ inputs.version }}
4847
options: --health-cmd="healthcheck.sh --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
4948
env:
5049
MYSQL_ALLOW_EMPTY_PASSWORD: yes
@@ -53,7 +52,7 @@ jobs:
5352

5453
steps:
5554
- name: Checkout code
56-
uses: actions/checkout@v3
55+
uses: actions/checkout@v4
5756

5857
- name: Setup PHP
5958
uses: shivammathur/setup-php@v2

.github/workflows/tests-mysql.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
version:
77
required: true
88
type: string
9+
matrix:
10+
required: true
11+
type: string
912

1013
jobs:
1114
test:
@@ -15,16 +18,7 @@ jobs:
1518
strategy:
1619
fail-fast: false
1720
matrix:
18-
php: [8.1, 8.2, 8.3, 8.4]
19-
laravel: [10.*, 11.*, 12.*]
20-
stability: [prefer-lowest, prefer-stable]
21-
exclude:
22-
# Laravel 12.x only supports PHP ^8.2
23-
- laravel: 12.*
24-
php: 8.1
25-
# Laravel 11.x only supports PHP ^8.2
26-
- laravel: 11.*
27-
php: 8.1
21+
include: ${{ fromJSON(inputs.matrix) }}
2822

2923
services:
3024
database:
@@ -39,7 +33,7 @@ jobs:
3933

4034
steps:
4135
- name: Checkout code
42-
uses: actions/checkout@v3
36+
uses: actions/checkout@v4
4337

4438
- name: Setup PHP
4539
uses: shivammathur/setup-php@v2

.github/workflows/tests-pgsql.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
version:
77
required: true
88
type: string
9+
matrix:
10+
required: true
11+
type: string
912

1013
jobs:
1114
test:
@@ -15,16 +18,7 @@ jobs:
1518
strategy:
1619
fail-fast: false
1720
matrix:
18-
php: [8.1, 8.2, 8.3, 8.4]
19-
laravel: [10.*, 11.*, 12.*]
20-
stability: [prefer-lowest, prefer-stable]
21-
exclude:
22-
# Laravel 12.x only supports PHP ^8.2
23-
- laravel: 12.*
24-
php: 8.1
25-
# Laravel 11.x only supports PHP ^8.2
26-
- laravel: 11.*
27-
php: 8.1
21+
include: ${{ fromJSON(inputs.matrix) }}
2822

2923
services:
3024
database:
@@ -37,7 +31,7 @@ jobs:
3731

3832
steps:
3933
- name: Checkout code
40-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
4135

4236
- name: Setup PHP
4337
uses: shivammathur/setup-php@v2

.github/workflows/tests-sqlite.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Testing (SQLite)
22

3-
on: workflow_call
3+
on:
4+
workflow_call:
5+
inputs:
6+
matrix:
7+
required: true
8+
type: string
49

510
jobs:
611
test:
@@ -10,20 +15,11 @@ jobs:
1015
strategy:
1116
fail-fast: false
1217
matrix:
13-
php: [8.1, 8.2, 8.3, 8.4]
14-
laravel: [10.*, 11.*, 12.*]
15-
stability: [prefer-lowest, prefer-stable]
16-
exclude:
17-
# Laravel 12.x only supports PHP ^8.2
18-
- laravel: 12.*
19-
php: 8.1
20-
# Laravel 11.x only supports PHP ^8.2
21-
- laravel: 11.*
22-
php: 8.1
18+
include: ${{ fromJSON(inputs.matrix) }}
2319

2420
steps:
2521
- name: Checkout code
26-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2723

2824
- name: Setup PHP
2925
uses: shivammathur/setup-php@v2

.github/workflows/tests-sqlsrv.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
version:
77
required: true
88
type: string
9+
matrix:
10+
required: true
11+
type: string
912

1013
jobs:
1114
test:
@@ -15,16 +18,7 @@ jobs:
1518
strategy:
1619
fail-fast: false
1720
matrix:
18-
php: [8.1, 8.2, 8.3, 8.4]
19-
laravel: [10.*, 11.*, 12.*]
20-
stability: [prefer-lowest, prefer-stable]
21-
exclude:
22-
# Laravel 12.x only supports PHP ^8.2
23-
- laravel: 12.*
24-
php: 8.1
25-
# Laravel 11.x only supports PHP ^8.2
26-
- laravel: 11.*
27-
php: 8.1
21+
include: ${{ fromJSON(inputs.matrix) }}
2822

2923
services:
3024
database:
@@ -38,7 +32,7 @@ jobs:
3832

3933
steps:
4034
- name: Checkout code
41-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
4236

4337
- name: Setup PHP
4438
uses: shivammathur/setup-php@v2

0 commit comments

Comments
 (0)