-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (141 loc) · 6.05 KB
/
Copy pathphp.yaml
File metadata and controls
159 lines (141 loc) · 6.05 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: PHP
env:
COMPOSE_USER: runner
on:
pull_request:
push:
branches:
- main
- develop
jobs:
coding-standards:
name: PHP - Check Coding Standards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Create docker network
run: |
docker network create frontend
- run: |
docker compose run --rm phpfpm composer install
docker compose run --rm phpfpm vendor/bin/php-cs-fixer fix --dry-run --diff
phpstan:
# Analysed on the highest supported PHP rather than the default 8.3
# service, so this job sees the newest dependency set Composer can
# resolve: league/oauth2-client declares a PHP *upper* bound, so which of
# its releases is installable depends on the runtime version. phpstan.neon
# pins the analysis to the declared php ^8.3 range, so the language floor
# stays protected from here; phpstan-lowest covers the dependency floor.
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Create docker network
run: |
docker network create frontend
- run: |
docker compose run --rm phpfpm85 composer install
docker compose run --rm phpfpm85 vendor/bin/phpstan
phpstan-lowest:
# The declared dependency floor, analysed with current dev tooling. A
# plain --prefer-lowest also downgrades PHPUnit and phpstan-mockery, and
# then most of what is reported is an artefact of that rather than a
# statement about the runtime dependencies. Lowering only what `require`
# names keeps the analysis about the versions this library claims to
# support.
#
# Runs on the PHP floor, in the default 8.3 service, as the counterpart
# to the phpstan job's ceiling on 8.5.
#
# Analysis only: never add a formatter to this job, and do not reuse the
# resulting vendor/ for anything but PHPStan.
name: PHPStan (lowest runtime dependencies)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Create docker network
run: |
docker network create frontend
- run: |
docker compose run --rm phpfpm composer install
docker compose run --rm phpfpm sh -c \
'composer update --prefer-lowest --with-all-dependencies $(composer show --direct --no-dev --name-only)'
docker compose run --rm phpfpm vendor/bin/phpstan
unit-tests:
name: Unit tests (${{ matrix.php }}, ${{ matrix.prefer }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- service: phpfpm
php: "8.3"
prefer: prefer-lowest
- service: phpfpm
php: "8.3"
prefer: prefer-stable
- service: phpfpm84
php: "8.4"
prefer: prefer-lowest
- service: phpfpm84
php: "8.4"
prefer: prefer-stable
- service: phpfpm85
php: "8.5"
prefer: prefer-lowest
- service: phpfpm85
php: "8.5"
prefer: prefer-stable
steps:
- uses: actions/checkout@v6
- name: Create docker network
run: |
docker network create frontend
- run: |
docker compose run --rm -e XDEBUG_MODE=coverage ${{ matrix.service }} composer update --${{ matrix.prefer }}
docker compose run --rm -e XDEBUG_MODE=coverage ${{ matrix.service }} vendor/bin/phpunit --coverage-clover=coverage/unit.xml
- name: Upload coverage to Codecov
if: matrix.service == 'phpfpm' && matrix.prefer == 'prefer-stable'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/unit.xml
fail_ci_if_error: true
flags: unittests
mutation-tests:
name: Mutation tests (${{ matrix.php }}, ${{ matrix.prefer }})
runs-on: ubuntu-latest
strategy:
matrix:
include:
- service: phpfpm
php: "8.3"
prefer: prefer-stable
steps:
- uses: actions/checkout@v6
- name: Create docker network
run: |
docker network create frontend
# The GITHUB_* variables are passed into the container so
# Infection's CI detection works: --logger-github emits inline PR
# annotations for escaped mutants, and the Stryker dashboard
# logger (configured in infection.json5) publishes the report on
# pushes to develop. The minimum mutation score is enforced via
# minCoveredMsi in infection.json5.
- name: Run Infection
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
run: |
docker compose run --rm ${{ matrix.service }} composer install
docker compose run --rm \
-e XDEBUG_MODE=coverage \
-e GITHUB_ACTIONS \
-e GITHUB_REF \
-e GITHUB_HEAD_REF \
-e GITHUB_SHA \
-e GITHUB_REPOSITORY \
-e GITHUB_EVENT_NAME \
-e GITHUB_RUN_ID \
-e GITHUB_SERVER_URL \
-e STRYKER_DASHBOARD_API_KEY \
${{ matrix.service }} vendor/bin/infection --logger-github