-
Notifications
You must be signed in to change notification settings - Fork 332
372 lines (311 loc) · 9.34 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
name: ci
on:
pull_request:
paths:
- configure
- 'auto/**'
- 'go/**'
- 'src/**'
- 'test/**'
- 'pkg/contrib/**'
- '.github/workflows/ci.yml'
push:
branches: master
paths:
- configure
- 'auto/**'
- 'go/**'
- 'src/**'
- 'test/**'
- 'pkg/contrib/**'
- '.github/workflows/ci.yml'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Core
- build: unit
os: ubuntu-latest
# Modules
- build: go-1.21
os: ubuntu-latest
- build: go-1.22
os: ubuntu-latest
- build: java-17
os: ubuntu-latest
- build: java-18
os: ubuntu-latest
- build: java-21
os: ubuntu-latest
- build: node-20
os: ubuntu-latest
- build: node-21
os: ubuntu-latest
- build: perl
os: ubuntu-latest
- build: php-8.2
os: ubuntu-latest
- build: php-8.3
os: ubuntu-latest
- build: python-3.11
os: ubuntu-latest
- build: python-3.12
os: ubuntu-latest
- build: ruby-3.2
os: ubuntu-latest
- build: ruby-3.3
os: ubuntu-latest
- build: wasm
os: ubuntu-latest
- build: wasm-wasi-component
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Provides module, language version and testpath from build name
- name: Output build metadata
id: metadata
run: |
if [ "${{ matrix.build }}" = "wasm-wasi-component" ]; then
module="wasm-wasi-component"
else
# Split the build name by '-' into module and version
IFS='-' read -r module version <<< "${{ matrix.build }}"
fi
testpath="test/test_${module}*"
# Run all tests for "unit" and "python"
# Python is the default module for tests
if [ "$module" = "unit" ] || [ "$module" = "python" ]; then
testpath="test"
fi
echo "module=${module}" >> "$GITHUB_OUTPUT"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "testpath=${testpath}" >> "$GITHUB_OUTPUT"
NJS_VERSION=$(sed -n "s/NJS_VERSION := \(.*\)/\1/p" pkg/contrib/src/njs/version)
echo "njs_version=${NJS_VERSION}" >> "$GITHUB_OUTPUT"
cat "$GITHUB_OUTPUT"
# https://github.com/actions/runner-images/issues/2821
- name: Kill mono process
run: |
set +e
sudo systemctl status mono-xsp4.service
if [ $? -ne 0 ]; then
true
else
sudo systemctl stop mono-xsp4.service
sudo systemctl mask mono-xsp4.service
sudo systemctl status mono-xsp4.service
PID=$(sudo lsof -t -i :8084)
echo "Killing PID $PID"
sudo kill -9 $PID
fi
##
## njs
##
- name: Clone njs repository
uses: actions/checkout@v4
with:
repository: nginx/njs
ref: '${{ steps.metadata.outputs.njs_version }}'
path: njs
- name: Make njs
run: |
./configure --no-libxml2 --no-zlib
make -j4 -k
working-directory: njs
##
## Unit
##
- name: Configure unit
run: |
./configure \
--tests \
--openssl \
--njs \
--cc-opt="-I njs/src/ -I njs/build" \
--ld-opt="-L njs/build"
- name: Make unit
run: |
make -j4 -k || make
##
## Go
##
- uses: actions/setup-go@v5
with:
go-version: '${{ steps.metadata.outputs.version }}'
cache: false
if: steps.metadata.outputs.module == 'go'
- name: Configure go
run: |
./configure go --go-path=
if: steps.metadata.outputs.module == 'go'
- name: Make go
run: |
make go
make go-install
if: steps.metadata.outputs.module == 'go'
##
## Java
##
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '${{ steps.metadata.outputs.version }}'
if: steps.metadata.outputs.module == 'java'
- name: Configure java
run: |
sudo ./configure java
if: steps.metadata.outputs.module == 'java'
- name: Make java
run: |
sudo make java
if: steps.metadata.outputs.module == 'java'
##
## Node
##
- uses: actions/setup-node@v4
with:
node-version: '${{ steps.metadata.outputs.version }}'
if: steps.metadata.outputs.module == 'node'
- name: Install node-gyp
run: |
npm install -g node-gyp
if: steps.metadata.outputs.module == 'node'
- name: Configure node
run: |
./configure nodejs
if: steps.metadata.outputs.module == 'node'
- name: Make node
run: |
make node-local-install DESTDIR=node
if: steps.metadata.outputs.module == 'node'
##
## Perl
##
# Uses default Actions VM Perl
# https://github.com/actions/runner-images#available-images
- name: Install libperl-dev
run: |
sudo apt-get install libperl-dev
if: steps.metadata.outputs.module == 'perl'
- name: Configure perl
run: |
./configure perl
if: steps.metadata.outputs.module == 'perl'
- name: Make perl
run: |
make perl
if: steps.metadata.outputs.module == 'perl'
##
## PHP
##
- uses: shivammathur/setup-php@v2
with:
php-version: '${{ steps.metadata.outputs.version }}'
extensions: none
env:
update: true
if: steps.metadata.outputs.module == 'php'
- name: Configure php
run: |
./configure php
if: steps.metadata.outputs.module == 'php'
- name: Make php
run: |
make php
if: steps.metadata.outputs.module == 'php'
##
## Python 3
##
- uses: actions/setup-python@v5
with:
python-version: '${{ steps.metadata.outputs.version }}'
if: steps.metadata.outputs.module == 'python'
- name: Configure python3
run: |
sudo ./configure python --config=python3-config
if: steps.metadata.outputs.module == 'python'
- name: Make python3
run: |
sudo make python3
if: steps.metadata.outputs.module == 'python'
##
## Ruby
##
- uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ steps.metadata.outputs.version }}'
if: steps.metadata.outputs.module == 'ruby'
- name: Install rack
run: |
gem install rack
if: steps.metadata.outputs.module == 'ruby'
- name: Configure ruby
run: |
./configure ruby
if: steps.metadata.outputs.module == 'ruby'
- name: Make ruby
run: |
make ruby
if: steps.metadata.outputs.module == 'ruby'
##
## Wasm
##
- name: Make wasmtime
run: |
make -C pkg/contrib .wasmtime
if: steps.metadata.outputs.module == 'wasm'
- name: Configure wasm
run: |
./configure wasm --include-path=pkg/contrib/wasmtime/artifacts/include --lib-path=pkg/contrib/wasmtime/artifacts/lib
if: steps.metadata.outputs.module == 'wasm'
- name: Make wasm
run: |
make wasm
if: steps.metadata.outputs.module == 'wasm'
##
## wasm-wasi-component
##
- name: Setup rust
run: |
curl https://sh.rustup.rs | sh -s -- -y
cargo install cargo-component
if: steps.metadata.outputs.module == 'wasm-wasi-component'
- name: Configure wasm-wasi-component
run: |
./configure wasm-wasi-component
if: steps.metadata.outputs.module == 'wasm-wasi-component'
- name: Make wasm-wasi-component
run: |
CLANG_PATH=/usr/bin/clang-15 \
BINDGEN_EXTRA_CLANG_ARGS="-I../../njs/src -I../../njs/build" \
make wasm-wasi-component
if: steps.metadata.outputs.module == 'wasm-wasi-component'
##
## Tests
##
# /home/runner will be root only after calling sudo above
# Ensure all users and processes can execute
- name: Fix permissions
run: |
sudo chmod -R +x /home/runner
namei -l ${{ github.workspace }}
# Install python3 if not present
- uses: actions/setup-python@v5
with:
python-version: '3'
if: steps.metadata.outputs.module != 'wasm'
- name: Install pytest
run: |
sudo apt install -y python3-pytest
if: steps.metadata.outputs.module != 'wasm'
- name: Run ${{ steps.metadata.outputs.module }} tests
run: |
if [ "${{ matrix.build }}" == "wasm-wasi-component" ]; then
pytest-3 --print-log ${{ steps.metadata.outputs.testpath }}
else
sudo -E pytest-3 --print-log ${{ steps.metadata.outputs.testpath }}
fi
if: steps.metadata.outputs.module != 'wasm'