-
Notifications
You must be signed in to change notification settings - Fork 1
161 lines (158 loc) · 5.04 KB
/
CI.yml
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
160
161
name: CI
permissions: read-all
on:
push:
branches:
- master
pull_request:
jobs:
tests:
name: Tests on PHP ${{ matrix.php }} ${{ matrix.dependencies }}
runs-on: ubuntu-22.04
services:
redis:
image: redis
ports:
- 6379/tcp
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
dependencies: ['', '--prefer-lowest --prefer-stable']
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
extensions: mbstring, redis, apcu
ini-values: apc.enable_cli=1, zend.assertions=1
coverage: pcov
- name: Remove Composer lockfile
run: rm composer.lock
- name: Install dependencies
run: composer update --no-interaction --prefer-dist ${{ matrix.dependencies }}
- name: Configure PHPUnit matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run tests
run: ./vendor/bin/phpunit --verbose --colors --coverage-clover=coverage.xml
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml
mutation_testing:
name: Mutation testing
runs-on: ubuntu-22.04
services:
redis:
image: redis
ports:
- 6379/tcp
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: shivammathur/[email protected]
with:
php-version: '8.1'
extensions: mbstring, redis, apcu
ini-values: apc.enable_cli=1, zend.assertions=1
coverage: pcov
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Run Infection
run: ./vendor/bin/infection --min-msi=90 --min-covered-msi=90
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Archive report
if: always()
uses: actions/upload-artifact@v4
with:
name: Infection report
path: infection.log
integration:
name: Integration tests on PHP ${{ matrix.php }}
runs-on: ubuntu-22.04
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Start stack
run: |
docker-compose up -d
sleep 10
docker ps -a
env:
PHP_VERSION: ${{ matrix.php }}
- name: Tests with Redis
run: docker-compose exec -T phpunit env ADAPTER=redis vendor/bin/phpunit --testsuite=functionnal
env:
PHP_VERSION: ${{ matrix.php }}
- name: Tests with APCU
run: docker-compose exec -T phpunit env ADAPTER=apcu vendor/bin/phpunit --testsuite=functionnal
env:
PHP_VERSION: ${{ matrix.php }}
code_quality:
name: Code quality
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: shivammathur/[email protected]
with:
php-version: '8.1'
extensions: mbstring, redis, apcu
coverage: none
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: PHPCS
run: ./vendor/bin/phpcs
- name: Psalm
run: ./vendor/bin/psalm --shepherd
- name: PHPStan
run: ./vendor/bin/phpstan analyse
dependencies:
name: Dependencies state
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Composer Require Checker
uses: docker://webfactory/composer-require-checker:3.2.0
with:
args: --config-file=tests/config-composer-require-checker.json
- name: Composer Unused
uses: docker://icanhazstring/composer-unused-ga
backward_compatible_changes:
name: Backward Compatible Changes
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
# Disable (temporarily) CI check with Roave BC check
# See https://github.com/Nyholm/roave-bc-check-docker/issues/32
#- name: Roave BC Check
# uses: docker://nyholm/roave-bc-check-ga
# with:
# args: roave-backwards-compatibility-check:assert-backwards-compatible --from=v1.0.0
nix-shell:
name: Working Nix Shell
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install nix
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Install dependencies
run: nix-shell --pure --run 'composer install --no-interaction --prefer-dist'
- name: Basic tests
run: nix-shell --pure --run './vendor/bin/psalm'