Skip to content

Commit 6a1c7c3

Browse files
authored
Run ci suite with matrix strategy (#13)
1 parent f5d3ec4 commit 6a1c7c3

File tree

2 files changed

+53
-19
lines changed

2 files changed

+53
-19
lines changed

.github/workflows/tests.yml

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,54 @@
1-
name: tests
2-
on: [push,pull_request]
1+
name: "Build"
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
pull_request:
8+
39
jobs:
410
build:
11+
name: PHP ${{ matrix.php }} with ${{ matrix.dependencies }} deps
512
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: true
16+
max-parallel: 8
17+
matrix:
18+
dependencies:
19+
- "lowest"
20+
- "locked"
21+
- "highest"
22+
php:
23+
- "7.4"
24+
- "8.0"
25+
- "8.1"
26+
627
steps:
7-
- uses: actions/checkout@v1
8-
- name: Get Composer Cache Directory
9-
id: composer-cache
10-
run: |
11-
echo "::set-output name=dir::$(composer config cache-files-dir)"
12-
- uses: actions/cache@v1
13-
with:
14-
path: ${{ steps.composer-cache.outputs.dir }}
15-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
16-
restore-keys: |
17-
${{ runner.os }}-composer-
18-
- name: Install dependencies
19-
run: composer install
20-
- name: Run tests
21-
run: composer tests
28+
- uses: actions/checkout@v3
29+
30+
- name: "Install PHP"
31+
uses: "shivammathur/setup-php@v2"
32+
with:
33+
coverage: "pcov"
34+
php-version: "${{ matrix.php }}"
35+
ini-values: memory_limit=-1
36+
37+
- name: "Install dependencies"
38+
uses: ramsey/composer-install@v2
39+
with:
40+
dependency-versions: "${{ matrix.dependencies }}"
41+
42+
- name: "Validate composer files"
43+
run: "composer validate"
44+
45+
- name: "Run code style check"
46+
if: ${{ matrix.dependencies == 'locked' }}
47+
run: "composer check-cs"
48+
49+
- name: "Run PHPStan"
50+
if: ${{ matrix.dependencies == 'locked' }}
51+
run: "composer sca"
52+
53+
- name: "Run tests"
54+
run: "composer tests"

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@
4040
"check-cs": "php-cs-fixer fix --dry-run",
4141
"fix-cs": "php-cs-fixer fix",
4242
"sca": "phpstan analyse",
43-
"tests": [
43+
"tests": "phpunit",
44+
"ci": [
4445
"@check-cs",
4546
"@sca",
46-
"phpunit"
47+
"@tests"
4748
]
4849
}
4950
}

0 commit comments

Comments
 (0)