-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (89 loc) · 3.49 KB
/
test.yml
File metadata and controls
112 lines (89 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Test
on:
workflow_call:
permissions:
contents: read
checks: write
jobs:
tests:
name: Tests (PHP ${{ matrix.php }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3', '8.4', '8.5']
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: ${{ matrix.php }}
extensions: json
coverage: xdebug
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update -n --prefer-dist
- name: Create build directory
run: mkdir -p build/logs
- name: Run tests
run: vendor/bin/phpunit --testdox --coverage-clover build/logs/clover.xml
- name: Check coverage threshold
run: php scripts/check-coverage-threshold.php build/logs/clover.xml
- name: Code Coverage Annotation
uses: ggilder/codecoverage@47c83daaf1d5a3190cad56363baf459c59114170 # v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERAGE_FILE_PATH: build/logs/clover.xml
COVERAGE_FORMAT: clover
- name: Upload test results
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: test-results-php-${{ matrix.php }}
path: build/logs/
retention-days: 7
mutation-testing:
name: Mutation Testing
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Setup PHP
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2
with:
php-version: '8.2'
extensions: json
coverage: xdebug
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update -n --prefer-dist
- name: Download Infection PHAR
run: |
wget https://github.com/infection/infection/releases/download/0.31.9/infection.phar
wget https://github.com/infection/infection/releases/download/0.31.9/infection.phar.asc
- name: Validate Infection PHAR
run: |
gpg --keyserver hkps://keys.openpgp.org --recv-keys C6D76C329EBADE2FB9C458CFC5095986493B4AA0
gpg --with-fingerprint --verify infection.phar.asc infection.phar
chmod +x infection.phar
- name: Run mutation testing
run: ./infection.phar --threads=max --min-msi=100 --min-covered-msi=100