-
Notifications
You must be signed in to change notification settings - Fork 19
150 lines (132 loc) · 4.92 KB
/
ci.yaml
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
name: CI
on:
pull_request:
push:
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
analyse:
runs-on: ubuntu-latest
env:
PHP_CS_FIXER_IGNORE_ENV: 1
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: none, curl, dom, json, mbstring, opcache, openssl, simplexml, tokenizer, xml, xmlwriter
coverage: none
- if: github.event_name != 'pull_request'
run: rm ./.dev-tools/composer.lock
- run: composer update --no-progress
- run: composer analyse
test:
name: PHP ${{ matrix.php-version }} ${{ matrix.description }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
description: 'with lowest dependencies'
composer-flags: '--prefer-lowest'
php-version: '7.4'
- os: ubuntu-latest
description: 'with lowest dependencies and shim package'
composer-flags: '--prefer-lowest'
use-shim-package: true
php-version: '7.4'
- os: ubuntu-latest
php-version: '8.0'
- os: ubuntu-latest
php-version: '8.1'
- os: ubuntu-latest
php-version: '8.2'
- os: ubuntu-latest
php-version: '8.3'
- os: ubuntu-latest
description: 'with calculating code coverage and Infection'
calculate-coverage: true
phpunit-flags: '--coverage-clover=./build/logs/clover.xml'
php-version: '8.4'
FAST_LINT_TEST_CASES: 1
- os: ubuntu-latest
description: 'with PHP CS Fixer from master'
with-php-cs-fixer-from-master: true
php-version: '8.4'
- os: ubuntu-latest
description: 'with shim package'
use-shim-package: true
php-version: '8.4'
- os: ubuntu-latest
description: 'with bootstrap'
with-bootstrap: true
php-version: '8.4'
- os: macos-latest
description: 'on macOS'
php-version: '8.4'
- os: windows-latest
description: 'on Windows'
php-version: '8.4'
FAST_LINT_TEST_CASES: 1
- os: ubuntu-latest
description: 'with PHPUnit 12'
php-version: '8.4'
install-phpunit-12: true
- os: ubuntu-latest
php-version: '8.5'
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
PHP_CS_FIXER_FUTURE_MODE: 1
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: none, ctype, curl, dom, json, mbstring, opcache, openssl, simplexml, tokenizer, xml, xmlwriter
ini-values: pcov.directory=$GITHUB_WORKSPACE/src, zend.assertions=1
coverage: ${{ (matrix.calculate-coverage && 'pcov') || 'none' }}
- id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- if: matrix.with-bootstrap
uses: sergeysova/jq-action@v2
with:
cmd: |
jq -r --indent 4 'del(.autoload."psr-4")' composer.json > composer.tmp
jq -r --indent 4 '.autoload += {"files": ["bootstrap.php"]}' composer.tmp > composer.json
- if: matrix.use-shim-package
run: sed -i 's#friendsofphp/php-cs-fixer#php-cs-fixer/shim#g' composer.json
- if: matrix.with-php-cs-fixer-from-master
run: composer require friendsofphp/php-cs-fixer:dev-master --no-update
- if: matrix.calculate-coverage
run: composer require --dev php-coveralls/php-coveralls --no-update
- if: matrix.install-phpunit-12
run: composer require --dev phpunit/phpunit:^12.0.2 --no-update
- run: composer update --no-progress --classmap-authoritative ${{ matrix.composer-flags }}
- if: matrix.install-phpunit-12
env:
PHP_CS_FIXER_IGNORE_ENV: 1
run: |
composer install-dev-tools
./vendor/bin/php-cs-fixer fix --quiet --rules=php_unit_attributes
- run: composer show | grep php-cs-fixer
- run: ./vendor/bin/phpunit ${{ matrix.phpunit-flags }}
env:
FAST_LINT_TEST_CASES: ${{ matrix.FAST_LINT_TEST_CASES }}
- if: matrix.calculate-coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
run: ./vendor/bin/php-coveralls --verbose
- if: matrix.calculate-coverage
env:
FAST_LINT_TEST_CASES: 1
run: composer infection