Skip to content

Commit 5261a02

Browse files
committed
ci: various ci improvements
- Run CI tests with/without Elements, also test minimal build as used by Jade - Enable -Werror for the main test run - Fail if scan-build errors are detected - Expose scan-build artifacts for investigating reported errors - Do not build release files if any tests fail
1 parent a9f5d80 commit 5261a02

File tree

1 file changed

+78
-51
lines changed

1 file changed

+78
-51
lines changed

.gitlab-ci.yml

Lines changed: 78 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,67 @@
11
variables:
22
GIT_SUBMODULE_STRATEGY: recursive
33

4-
build_wally_release_files:
5-
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
6-
artifacts:
7-
expire_in: 7 days
8-
name: wallycore-bindings
9-
when: on_success
10-
paths:
11-
- dist/*
12-
tags:
13-
- ga
14-
script:
15-
- python3 -m build
16-
- virtualenv -p python3 .smoketest
17-
- source .smoketest/bin/activate
18-
- pip install --find-links=./dist wallycore
19-
- python -c "import wallycore as w; assert w.hex_from_bytes(w.hex_to_bytes('ff')) == 'ff'"
20-
- deactivate
21-
- rm -rf .smoketest dist/*.whl
22-
- mv dist wally_dist
23-
- ./tools/build_android_libraries.sh
24-
- mv release wallycore-android-jni
25-
- tar czf wally_dist/wallycore-android-jni.tar.gz --remove-files wallycore-android-jni
26-
- source /opt/emsdk/emsdk_env.sh
27-
- tools/build_wasm.sh
28-
- cd dist
29-
- tar czf wallycore-wasm.tar.gz --remove-files wallycore.html wallycore.js wallycore.wasm
30-
- cd ..
31-
- sphinx-build -b html -a -c docs/source docs/source docs/build/html
32-
- cd docs/build
33-
- tar czf ../../wally_dist/apidocs.tar.gz html/
34-
- cd ../..
35-
- mv wally_dist/* dist/
36-
- rmdir wally_dist
4+
stages:
5+
- test
6+
- release
377

38-
build_mingw_static:
39-
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
40-
tags:
41-
- ga
42-
script:
43-
- ./tools/cleanup.sh && ./tools/autogen.sh
44-
- CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32 --disable-swig-python --disable-swig-java --disable-shared --enable-static
45-
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
46-
47-
run_tests:
8+
test_with_valgrind:
9+
stage: test
4810
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
11+
parallel:
12+
matrix:
13+
- CONFIGURE_ARGS: [--enable-elements=yes,--enable-elements=no,--enable-minimal=yes]
4914
tags:
5015
- ga
5116
artifacts:
5217
reports:
5318
codequality: valgrind.json
5419
script:
5520
- ./tools/cleanup.sh && ./tools/autogen.sh
56-
- ./configure --enable-export-all --enable-swig-python --enable-swig-java --enable-shared --disable-static
21+
- CFLAGS='-Werror' ./configure --enable-export-all --enable-swig-python --enable-swig-java $CONFIGURE_ARGS --enable-shared --disable-static
5722
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
5823
- make check -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
5924
- for t in $(ls src/.libs/test_* | egrep -v '_clear|xml|json' | tr '\n' ' '); do LD_LIBRARY_PATH=./src/.libs/ valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --xml=yes --xml-file=$t.xml $t; done
6025
- for t in $(ls src/.libs/test_* | egrep -v '_clear|xml|json' | tr '\n' ' '); do valgrind-codequality --input-file $t.xml --output-file $t.json; done
6126
- jq '[.[]|.[]]' -s ./src/.libs/test_*.json > valgrind.json
6227

63-
run_asan_ubsan_gcc:
28+
test_asan_ubsan_gcc:
29+
stage: test
6430
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
31+
parallel:
32+
matrix:
33+
- CONFIGURE_ARGS: [--enable-elements=yes, --enable-elements=no,--enable-minimal=yes]
6534
tags:
6635
- ga
6736
script:
6837
- ./tools/cleanup.sh && ./tools/autogen.sh
69-
- CC=gcc CFLAGS="-O1 -fsanitize=address -fsanitize=undefined -fsanitize=alignment -fsanitize-address-use-after-scope -fno-sanitize-recover=all" ./configure --enable-export-all --enable-swig-python --enable-swig-java --enable-shared --disable-static --disable-clear-tests --disable-asm
38+
- CC=gcc CFLAGS="-O2 -fsanitize=address -fsanitize=undefined -fsanitize=alignment -fsanitize-address-use-after-scope -fno-sanitize-recover=all" ./configure --enable-export-all --enable-swig-python --enable-swig-java $CONFIGURE_ARGS --enable-shared --disable-static --disable-clear-tests --disable-asm
7039
- sed -i 's/^PYTHON = /PYTHON = LD_PRELOAD=\/usr\/lib\/gcc\/x86_64-linux-gnu\/10\/libasan.so /g' src/Makefile
7140
- sed -i 's/^JAVA = /JAVA = LD_PRELOAD=\/usr\/lib\/gcc\/x86_64-linux-gnu\/10\/libasan.so /g' src/Makefile
7241
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
7342
- ASAN_OPTIONS=abort_on_error=1:fast_unwind_on_malloc=0:detect_leaks=0 UBSAN_OPTIONS=print_stacktrace=1 make check V=1
7443

75-
run_scan_build_clang:
44+
test_scan_build_clang:
45+
stage: test
7646
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
47+
parallel:
48+
matrix:
49+
- CONFIGURE_ARGS: [--enable-elements=yes, --enable-elements=no,--enable-minimal=yes]
7750
tags:
7851
- ga
7952
script:
8053
- ./tools/cleanup.sh && ./tools/autogen.sh
81-
- CC=clang CFLAGS="-O0" scan-build-11 ./configure --enable-export-all --enable-swig-python --enable-swig-java --disable-clear-tests --disable-asm
82-
- scan-build-11 --keep-cc --exclude src/secp256k1/ make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
54+
- CC=clang scan-build-11 ./configure --enable-export-all --enable-swig-python --enable-swig-java --disable-clear-tests --disable-asm
55+
- scan-build-11 --keep-cc --exclude src/secp256k1/ --status-bugs --keep-empty -o scan-build$CONFIGURE_ARGS make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
56+
artifacts:
57+
expire_in: 3 days
58+
name: scan-build$CONFIGURE_ARGS
59+
when: on_success
60+
paths:
61+
- scan-build$CONFIGURE_ARGS/*
8362

84-
cmake-test:
63+
test_cmake:
64+
stage: test
8565
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
8666
tags:
8767
- ga
@@ -110,7 +90,8 @@ cmake-test:
11090
coverage_format: cobertura
11191
path: coverage.xml
11292

113-
amalgamation-test:
93+
test_amalgamation:
94+
stage: test
11495
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
11596
tags:
11697
- ga
@@ -120,3 +101,49 @@ amalgamation-test:
120101
- gcc -DBUILD_ELEMENTS -Wall -W -Wextra -Werror -I. -I./src -I./src/ccan -I./src/secp256k1/include src/ctest/amalgamation_compile_test.c
121102
- clang -Wall -W -Wextra -Werror -I. -I./src -I./src/ccan -I./src/secp256k1/include src/ctest/amalgamation_compile_test.c
122103
- clang -DBUILD_ELEMENTS -Wall -W -Wextra -Werror -I. -I./src -I./src/ccan -I./src/secp256k1/include src/ctest/amalgamation_compile_test.c
104+
105+
test_mingw_static_build:
106+
stage: test
107+
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
108+
tags:
109+
- ga
110+
script:
111+
- ./tools/cleanup.sh && ./tools/autogen.sh
112+
- CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32 --disable-swig-python --disable-swig-java --disable-shared --enable-static
113+
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
114+
115+
build_wally_release_files:
116+
stage: release
117+
needs: [test_mingw_static_build,test_with_valgrind,test_asan_ubsan_gcc,test_scan_build_clang,test_cmake,test_amalgamation]
118+
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
119+
artifacts:
120+
expire_in: 7 days
121+
name: wallycore-bindings
122+
when: on_success
123+
paths:
124+
- dist/*
125+
tags:
126+
- ga
127+
script:
128+
- python3 -m build
129+
- virtualenv -p python3 .smoketest
130+
- source .smoketest/bin/activate
131+
- pip install --find-links=./dist wallycore
132+
- python -c "import wallycore as w; assert w.hex_from_bytes(w.hex_to_bytes('ff')) == 'ff'"
133+
- deactivate
134+
- rm -rf .smoketest dist/*.whl
135+
- mv dist wally_dist
136+
- ./tools/build_android_libraries.sh
137+
- mv release wallycore-android-jni
138+
- tar czf wally_dist/wallycore-android-jni.tar.gz --remove-files wallycore-android-jni
139+
- source /opt/emsdk/emsdk_env.sh
140+
- tools/build_wasm.sh
141+
- cd dist
142+
- tar czf wallycore-wasm.tar.gz --remove-files wallycore.html wallycore.js wallycore.wasm
143+
- cd ..
144+
- sphinx-build -b html -a -c docs/source docs/source docs/build/html
145+
- cd docs/build
146+
- tar czf ../../wally_dist/apidocs.tar.gz html/
147+
- cd ../..
148+
- mv wally_dist/* dist/
149+
- rmdir wally_dist

0 commit comments

Comments
 (0)