forked from danielstjules/Stringy
-
-
Notifications
You must be signed in to change notification settings - Fork 24
153 lines (137 loc) · 4.73 KB
/
ci.yml
File metadata and controls
153 lines (137 loc) · 4.73 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
name: CI
on:
push:
branches:
- master
pull_request:
defaults:
run:
shell: bash
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Keep the "modern" leg on PHPUnit 9 until the suite is upgraded for
# PHPUnit 10+, so CI currently stops at PHP 8.4.
include:
- php: '7.1'
composer: basic
phpunit: '^7.5'
phpunit_config: phpunit.legacy.xml.dist
- php: '7.2'
composer: basic
phpunit: '^8.5'
phpunit_config: phpunit.legacy.xml.dist
- php: '7.3'
composer: basic
phpunit: '^9.6'
phpunit_config: phpunit.xml.dist
- php: '7.4'
composer: basic
phpunit: '^9.6'
phpunit_config: phpunit.xml.dist
- php: '8.0'
composer: basic
phpunit: '^9.6'
phpunit_config: phpunit.xml.dist
- php: '8.1'
composer: basic
phpunit: '^9.6'
phpunit_config: phpunit.xml.dist
- php: '8.2'
composer: basic
phpunit: '^9.6'
phpunit_config: phpunit.xml.dist
- php: '8.3'
composer: basic
phpunit: '^9.6'
phpunit_config: phpunit.xml.dist
run_infection: true
- php: '8.4'
composer: basic
phpunit: '^9.6'
phpunit_config: phpunit.xml.dist
# Infection mutates and re-runs the suite, so that leg needs a longer timeout.
timeout-minutes: ${{ matrix.run_infection && 30 || 10 }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: zip
tools: 'composer'
- name: Determine composer cache directory
id: composer-cache
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-
- name: Install dependencies
run: |
composer require --dev --no-update "phpunit/phpunit:${{ matrix.phpunit }}"
if [[ "${{ matrix.run_infection }}" == "true" ]]; then
composer config --no-plugins allow-plugins.infection/extension-installer false
composer require --dev --no-update "infection/infection:^0.32.7"
fi
if [[ "${{ matrix.composer }}" == "lowest" ]]; then
composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable
fi;
if [[ "${{ matrix.composer }}" == "basic" ]]; then
composer update --prefer-dist --no-interaction
fi;
composer dump-autoload -o
- name: Run tests
run: |
mkdir -p build/logs
XDEBUG_MODE=coverage php vendor/bin/phpunit -c "${{ matrix.phpunit_config }}"
- name: Run phpstan
continue-on-error: true
if: ${{ matrix.php == '8.1' }}
run: |
php vendor/bin/phpstan analyse
- name: Run infection with phpstan integration
if: ${{ matrix.run_infection == true }}
run: |
XDEBUG_MODE=coverage php vendor/bin/infection \
--configuration=infection.json.dist \
--threads=max \
--ignore-msi-with-no-mutations \
--only-covering-test-cases \
--logger-github
- name: Upload coverage results to Coveralls
if: ${{ matrix.php == '8.3' }}
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
- name: Upload coverage results to Codecov
if: ${{ matrix.php == '8.3' }}
continue-on-error: true
uses: codecov/codecov-action@v4
with:
files: build/logs/clover.xml
- name: Upload coverage results to Scrutinizer
if: ${{ matrix.php == '8.3' }}
continue-on-error: true
uses: sudo-bot/action-scrutinizer@latest
with:
cli-args: "--format=php-clover build/logs/clover.xml"
- name: Archive logs artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: logs_composer-${{ matrix.composer }}_php-${{ matrix.php }}
path: |
build/logs