-
Notifications
You must be signed in to change notification settings - Fork 913
471 lines (427 loc) · 14.2 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
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
---
name: Continuous Integration
on:
push:
branches:
- "master"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# Makes the upload-artifact work more reliably at the cost
# of a bit of compile time.
RUST_PROFILE: release
SLOW_MACHINE: 1
CI_SERVER_URL: "http://35.239.136.52:3170"
jobs:
prebuild:
name: Pre-build checks
runs-on: ubuntu-20.04
timeout-minutes: 30
env:
BOLTDIR: bolts
strategy:
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Rebase
# We can't rebase if we're on master already.
if: github.ref != 'refs/heads/master'
run: |
git config user.name github-actions
git config user.email [email protected]
git fetch origin ${{ github.base_ref }}
git rebase origin/${{ github.base_ref }}
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
bash -x .github/scripts/setup.sh
pip install -U pip wheel poetry
# Export and then use pip to install into the current env
poetry export -o /tmp/requirements.txt --without-hashes --with dev
pip install -r /tmp/requirements.txt
# We're going to check BOLT quotes, so get the latest version
git clone https://github.com/lightning/bolts.git ../${BOLTDIR}
- name: Configure
run: ./configure --enable-debugbuild --enable-rust
- name: Check source
run: make -j 4 check-source BASE_REF="origin/${{ github.base_ref }}"
- name: Check Generated Files have been updated
run: make -j 4 check-gen-updated
- name: Check docs
run: make -j 4 check-doc
compile:
name: Compile CLN ${{ matrix.cfg }}
runs-on: ubuntu-22.04
timeout-minutes: 30
needs:
- prebuild
strategy:
fail-fast: true
matrix:
include:
- CFG: compile-gcc
VALGRIND: 1
COMPILER: gcc
- CFG: compile-gcc-O3
VALGRIND: 1
COMPILER: gcc
COPTFLAGS_VAR: COPTFLAGS="-O3 -Werror"
# While we're at it let's try to compile with clang
- CFG: compile-clang
VALGRIND: 1
COMPILER: clang
- CFG: compile-clang-sanitizers
COMPILER: clang
ASAN: 1
UBSAN: 1
VALGRIND: 0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
bash -x .github/scripts/setup.sh
- name: Build
env:
COMPILER: ${{ matrix.COMPILER }}
ASAN: ${{ matrix.ASAN }}
UBSAN: ${{ matrix.UBSAN }}
VALGRIND: ${{ matrix.VALGRIND }}
COMPAT: 1
CFG: ${{ matrix.CFG }}
run: |
set -e
pip3 install --user pip wheel poetry
poetry export -o requirements.txt --with dev --without-hashes
python3 -m pip install -r requirements.txt
./configure --enable-debugbuild CC="$COMPILER" ${{ matrix.COPTFLAGS_VAR }}
make -j $(nproc) testpack.tar.bz2
# Rename now so we don't clash
mv testpack.tar.bz2 cln-${CFG}.tar.bz2
- name: Check rust packages
run: cargo test --all
- uses: actions/upload-artifact@v3
with:
name: cln-${{ matrix.CFG }}.tar.bz2
path: cln-${{ matrix.CFG }}.tar.bz2
check-units:
# The unit test checks are not in the critical path (not dependent
# on the integration tests), so run them with `valgrind`
name: Run unit tests
runs-on: ubuntu-22.04
timeout-minutes: 30
env:
BOLTDIR: bolts
needs:
- compile
strategy:
fail-fast: true
matrix:
include:
- CFG: compile-gcc
VALGRIND: 1
- CFG: compile-clang-sanitizers
VALGRIND: 0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
bash -x .github/scripts/setup.sh
sudo apt-get update -qq
sudo apt-get install -y -qq lowdown
pip install -U pip wheel poetry
# Export and then use pip to install into the current env
poetry export -o /tmp/requirements.txt --without-hashes --with dev
pip install -r /tmp/requirements.txt
# We're going to check BOLT quotes, so get the latest version
git clone https://github.com/lightning/bolts.git ../${BOLTDIR}
- name: Download build
uses: actions/download-artifact@v3
with:
name: cln-${{ matrix.CFG }}.tar.bz2
- name: Check
run: |
tar -xaf cln-${{ matrix.CFG }}.tar.bz2
make -j $(nproc) check-units installcheck VALGRIND=${{ matrix.VALGRIND }}
check-fuzz:
name: Run fuzz regression tests
runs-on: ubuntu-22.04
needs:
- prebuild
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
bash -x .github/scripts/setup.sh
pip install -U pip wheel poetry
# Export and then use pip to install into the current env
poetry export -o /tmp/requirements.txt --without-hashes --with dev
pip install -r /tmp/requirements.txt
- name: Build
run: |
./configure --enable-debugbuild --enable-fuzzing --enable-address-sanitizer --enable-ub-sanitizer --disable-valgrind CC=clang
make -j $(nproc) check-fuzz
integration:
name: Test CLN ${{ matrix.name }}
runs-on: ubuntu-22.04
timeout-minutes: 120
env:
BITCOIN_VERSION: "25.1"
ELEMENTS_VERSION: 22.0.2
RUST_PROFILE: release # Has to match the one in the compile step
PYTEST_OPTS: --timeout=1200
needs:
- compile
strategy:
fail-fast: true
matrix:
include:
- NAME: gcc
CFG: compile-gcc
TEST_DB_PROVIDER: sqlite3
COMPILER: gcc
TEST_NETWORK: regtest
# While we're at it let's try to compile with clang
- NAME: clang
CFG: compile-clang
TEST_DB_PROVIDER: sqlite3
COMPILER: clang
TEST_NETWORK: regtest
# And of course we want to test postgres too
- NAME: postgres
CFG: compile-gcc
COMPILER: gcc
TEST_DB_PROVIDER: postgres
TEST_NETWORK: regtest
# And don't forget about elements (like cdecker did when
# reworking the CI...)
- NAME: liquid
CFG: compile-gcc
COMPILER: gcc
TEST_NETWORK: liquid-regtest
TEST_DB_PROVIDER: sqlite3
# And dual funding!
- NAME: dual-fund
CFG: compile-gcc
TEST_DB_PROVIDER: sqlite3
COMPILER: gcc
TEST_NETWORK: regtest
EXPERIMENTAL_DUAL_FUND: 1
# And splicing!
- NAME: splicing
CFG: compile-gcc
TEST_DB_PROVIDER: sqlite3
COMPILER: gcc
TEST_NETWORK: regtest
EXPERIMENTAL_SPLICING: 1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
pip3 install --user pip wheel poetry
poetry install
- name: Install bitcoind
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
run: .github/scripts/install-bitcoind.sh
- name: Download build
uses: actions/download-artifact@v3
with:
name: cln-${{ matrix.CFG }}.tar.bz2
- name: Unpack pre-built CLN
env:
CFG: ${{ matrix.CFG }}
run: |
tar -xaf cln-${CFG}.tar.bz2
- name: Switch network
if: ${{ matrix.TEST_NETWORK == 'liquid-regtest' }}
run: |
# Loading the network from config.vars rather than the envvar is a terrible idea...
sed -i 's/TEST_NETWORK=regtest/TEST_NETWORK=liquid-regtest/g' config.vars
cat config.vars
- name: Test
env:
COMPILER: ${{ matrix.COMPILER }}
EXPERIMENTAL_DUAL_FUND: ${{ matrix.EXPERIMENTAL_DUAL_FUND }}
EXPERIMENTAL_SPLICING: ${{ matrix.EXPERIMENTAL_SPLICING }}
COMPAT: 1
CFG: ${{ matrix.CFG }}
SLOW_MACHINE: 1
PYTEST_PAR: 10
TEST_DEBUG: 1
TEST_DB_PROVIDER: ${{ matrix.TEST_DB_PROVIDER }}
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
LIGHTNINGD_POSTGRES_NO_VACUUM: 1
run: |
env
cat config.vars
VALGRIND=0 poetry run pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS}
integration-valgrind:
name: Valgrind Test CLN ${{ matrix.name }}
runs-on: ubuntu-22.04
timeout-minutes: 120
env:
BITCOIN_VERSION: "25.1"
ELEMENTS_VERSION: 22.0.2
RUST_PROFILE: release # Has to match the one in the compile step
CFG: compile-gcc
PYTEST_OPTS: --test-group-random-seed=42 --timeout=1800
needs:
- compile
strategy:
fail-fast: true
matrix:
include:
- NAME: Valgrind (01/10)
PYTEST_OPTS: --test-group=1 --test-group-count=10
- NAME: Valgrind (02/10)
PYTEST_OPTS: --test-group=2 --test-group-count=10
- NAME: Valgrind (03/10)
PYTEST_OPTS: --test-group=3 --test-group-count=10
- NAME: Valgrind (04/10)
PYTEST_OPTS: --test-group=4 --test-group-count=10
- NAME: Valgrind (05/10)
PYTEST_OPTS: --test-group=5 --test-group-count=10
- NAME: Valgrind (06/10)
PYTEST_OPTS: --test-group=6 --test-group-count=10
- NAME: Valgrind (07/10)
PYTEST_OPTS: --test-group=7 --test-group-count=10
- NAME: Valgrind (08/10)
PYTEST_OPTS: --test-group=8 --test-group-count=10
- NAME: Valgrind (09/10)
PYTEST_OPTS: --test-group=9 --test-group-count=10
- NAME: Valgrind (10/10)
PYTEST_OPTS: --test-group=10 --test-group-count=10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -yyq valgrind
pip3 install --user pip wheel poetry
poetry install
- name: Install bitcoind
run: .github/scripts/install-bitcoind.sh
- name: Download build
uses: actions/download-artifact@v3
with:
name: cln-compile-gcc.tar.bz2
- name: Unpack build
run: tar -xvjf cln-compile-gcc.tar.bz2
- name: Test
env:
SLOW_MACHINE: 1
TEST_DEBUG: 1
run: |
VALGRIND=1 poetry run pytest tests/ -vvv -n 3 ${PYTEST_OPTS} ${{ matrix.PYTEST_OPTS }}
integration-sanitizers:
name: Sanitizers Test CLN
runs-on: ubuntu-22.04
timeout-minutes: 120
env:
BITCOIN_VERSION: "25.1"
ELEMENTS_VERSION: 22.0.2
RUST_PROFILE: release
SLOW_MACHINE: 1
TEST_DEBUG: 1
PYTEST_OPTS: --test-group-random-seed=42 --timeout=1800
needs:
- compile
strategy:
fail-fast: true
matrix:
include:
- NAME: ASan/UBSan (01/10)
PYTEST_OPTS: --test-group=1 --test-group-count=10
- NAME: ASan/UBSan (02/10)
PYTEST_OPTS: --test-group=2 --test-group-count=10 -n 1
- NAME: ASan/UBSan (03/10)
PYTEST_OPTS: --test-group=3 --test-group-count=10
- NAME: ASan/UBSan (04/10)
PYTEST_OPTS: --test-group=4 --test-group-count=10
- NAME: ASan/UBSan (05/10)
PYTEST_OPTS: --test-group=5 --test-group-count=10
- NAME: ASan/UBSan (06/10)
PYTEST_OPTS: --test-group=6 --test-group-count=10
- NAME: ASan/UBSan (07/10)
PYTEST_OPTS: --test-group=7 --test-group-count=10
- NAME: ASan/UBSan (08/10)
PYTEST_OPTS: --test-group=8 --test-group-count=10
- NAME: ASan/UBSan (09/10)
PYTEST_OPTS: --test-group=9 --test-group-count=10
- NAME: ASan/UBSan (10/10)
PYTEST_OPTS: --test-group=10 --test-group-count=10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
bash -x .github/scripts/setup.sh
set -e
pip3 install --user pip wheel poetry
poetry export -o requirements.txt --with dev --without-hashes
python3 -m pip install -r requirements.txt
poetry install
- name: Install bitcoind
run: .github/scripts/install-bitcoind.sh
- name: Download build
uses: actions/download-artifact@v3
with:
name: cln-compile-clang-sanitizers.tar.bz2
- name: Unpack build
run: tar -xvjf cln-compile-clang-sanitizers.tar.bz2
- name: Test
run: |
poetry run pytest tests/ -vvv -n 2 ${PYTEST_OPTS} ${{ matrix.PYTEST_OPTS }}
gather:
# A dummy task that depends on the full matrix of tests, and
# signals successful completion. Used for the PR status to pass
# before merging.
name: CI completion
runs-on: ubuntu-20.04
needs:
- integration
- check-units
- integration-valgrind
- integration-sanitizers
steps:
- name: Complete
run: |
echo CI completed successfully