Skip to content

Commit 7942c8a

Browse files
committed
feat: Add matrix for testring across PHP versions + static analysis
1 parent 2a5e728 commit 7942c8a

2 files changed

Lines changed: 60 additions & 10 deletions

File tree

.github/workflows/build_and_test.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
name: build_and_test
2-
on: [ push ]
2+
on:
3+
push:
4+
branches: [ main, develop ]
5+
pull_request:
6+
branches: [ main, develop ]
7+
38
jobs:
49
test:
5-
name: build_and_test
10+
name: PHP ${{ matrix.php-version }} Test
611
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
php-version: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
15+
fail-fast: false # Continue with other versions even if one fails
16+
717
steps:
818
- name: Checkout code
919
uses: actions/checkout@v2
1020

11-
- name: Setup PHP, with composer and extensions
21+
- name: Setup PHP ${{ matrix.php-version }}
1222
uses: shivammathur/setup-php@v2
1323
with:
14-
php-version: 8.1
24+
php-version: ${{ matrix.php-version }}
1525

1626
- name: Cache Composer dependencies
1727
uses: actions/cache@v4
1828
with:
1929
path: vendor
20-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
30+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
2131
restore-keys: |
22-
${{ runner.os }}-composer-
32+
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
2333
2434
- name: Install Composer dependencies
25-
run: composer update
35+
run: COMPOSER_ROOT_VERSION=dev-develop composer install --no-interaction --prefer-dist
2636

2737
- name: Run tests
2838
run: composer test
29-
30-
- name: PHPStan Static Analysis
31-
run: composer analyse
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: static_analysis
2+
on:
3+
pull_request:
4+
# Run on push, but only if PHP files have changed
5+
push:
6+
branches: [ main, develop ]
7+
paths:
8+
- '**.php'
9+
- 'composer.json'
10+
- 'composer.lock'
11+
- 'phpstan.neon'
12+
- '.github/workflows/static_analysis.yml'
13+
14+
env:
15+
GITHUB_ACTIONS_NOTIFY_ON_FAILURE: false
16+
17+
jobs:
18+
phpstan:
19+
name: Static Analysis
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: '8.5'
29+
30+
- name: Cache Composer dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: vendor
34+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-composer-
37+
38+
- name: Install Composer dependencies
39+
run: COMPOSER_ROOT_VERSION=dev-develop composer install --no-interaction --prefer-dist
40+
41+
- name: Run PHPStan
42+
run: composer analyse
43+
continue-on-error: true

0 commit comments

Comments
 (0)