-
Notifications
You must be signed in to change notification settings - Fork 4
194 lines (194 loc) · 7.07 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
flake-check:
name: Flake check
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: opentelemetry
extraPullNames: nix-shell, php-src-nix
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Setup Nix magic cache
uses: DeterminateSystems/magic-nix-cache-action@v9
- name: Run Nix Flake check
run: nix flake check
php-cs-fixer:
name: PHP CS Fixer (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '8.3'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: opentelemetry
extraPullNames: nix-shell, php-src-nix
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Setup Nix magic cache
uses: DeterminateSystems/magic-nix-cache-action@v9
- name: Instantiate Nix develop
uses: nicknovitski/nix-develop@v1
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-tools-php-cs-fixer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-tools-php-cs-fixer
- name: List PHP installed extensions
run: php -m
- name: Install PHP CS Fixer dependencies
run: cd tools/php-cs-fixer && composer update --no-interaction --no-progress --ansi
- name: Run PHP-CS-Fixer fix
run: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff --ansi
phpstan:
name: PHPStan (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '8.3'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: opentelemetry
extraPullNames: nix-shell, php-src-nix
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Setup Nix magic cache
uses: DeterminateSystems/magic-nix-cache-action@v9
- name: Instantiate Nix develop
uses: nicknovitski/nix-develop@v1
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-tools-phpstan-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-tools-phpstan
- name: List PHP installed extensions
run: php -m
- name: Install PHPStan dependencies
run: |
composer update --no-interaction --no-progress --ansi
cd tools/phpstan && composer update --no-interaction --no-progress --ansi
- name: Cache PHPStan results
uses: actions/cache@v4
with:
path: /tmp/phpstan
key: phpstan-php${{ matrix.php }}-${{ github.sha }}
restore-keys: |
phpstan-php${{ matrix.php }}-
phpstan-
continue-on-error: true
- name: Run PHPStan analysis
run: |
tools/phpstan/vendor/bin/phpstan --version
tools/phpstan/vendor/bin/phpstan analyse --no-interaction --no-progress --ansi --error-format=github --memory-limit=256M
phpunit:
name: PHPUnit (PHP ${{ matrix.php }}, ${{ matrix.dependencies }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '8.2'
- '8.3'
dependencies:
- 'highest'
include:
- php: '8.3'
dependencies: 'highest'
coverage: true
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: opentelemetry
extraPullNames: nix-shell, php-src-nix
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Setup Nix magic cache
uses: DeterminateSystems/magic-nix-cache-action@v9
- name: Instantiate Nix develop
uses: nicknovitski/nix-develop@v1
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.dependencies }}-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi ${{ matrix.dependencies == 'lowest' && '--prefer-lowest --prefer-stable' || '' }}
- name: Create database & schema
run: composer test:console -- doctrine:schema:update --force --complete
- name: Run PHPUnit tests
run: vendor/bin/phpunit --log-junit build/logs/phpunit/junit.xml ${{ matrix.coverage && '--coverage-clover build/logs/phpunit/clover.xml' || '' }}
env:
XDEBUG_MODE: coverage
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: phpunit-logs-php${{ matrix.php }}-${{ matrix.dependencies }}
path: build/logs/phpunit
- name: Upload coverage results to Codecov
if: matrix.coverage
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: build/logs/phpunit
name: phpunit-php${{ matrix.php }}
flags: phpunit
fail_ci_if_error: true
continue-on-error: true
- name: Upload coverage results to Coveralls
if: matrix.coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls
export PATH="$PATH:$HOME/.composer/vendor/bin"
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml
continue-on-error: true