-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
168 lines (159 loc) · 7.44 KB
/
.gitlab-ci.yml
File metadata and controls
168 lines (159 loc) · 7.44 KB
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
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- test
- release
test_with_valgrind:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
parallel:
matrix:
- CONFIGURE_ARGS: [--enable-elements=yes,--enable-elements=no,--enable-minimal=yes]
tags:
- ga
artifacts:
reports:
codequality: valgrind.json
script:
- ./tools/cleanup.sh && ./tools/autogen.sh
- CFLAGS='-Werror' ./configure --enable-export-all --enable-swig-python --enable-swig-java $CONFIGURE_ARGS --enable-shared --disable-static
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
- make check -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
- 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
- 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
- for t in $(ls src/test/test_*.py | tr '\n' ' '); do WALLY_SKIP_EXPENSIVE_TESTS=1 PYTHONMALLOC=malloc PYTHONDEVMODE=1 MALLOC_CHECK_=3 valgrind --tool=memcheck --leak-check=no --verbose --xml=yes --xml-file=$t.xml python $t; done
- for t in $(ls src/test/test_*.py | tr '\n' ' '); do valgrind-codequality --input-file $t.xml --output-file $t.json; done
- jq '[.[]|.[]]' -s ./src/.libs/test_*.json src/test/test_*.json > valgrind.json || true
test_asan_ubsan_gcc:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
parallel:
matrix:
- CONFIGURE_ARGS: [ --enable-elements=no, --enable-elements=no --enable-minimal=yes, "", --enable-minimal=yes ]
tags:
- ga
script:
- ./tools/cleanup.sh && ./tools/autogen.sh
- CC=gcc CFLAGS="-O2 -fsanitize=address -fsanitize=bounds -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
- sed -i 's/^PYTHON = /PYTHON = LD_PRELOAD=\/usr\/lib\/gcc\/x86_64-linux-gnu\/10\/libasan.so /g' src/Makefile
- sed -i 's/^JAVA = /JAVA = LD_PRELOAD=\/usr\/lib\/gcc\/x86_64-linux-gnu\/10\/libasan.so /g' src/Makefile
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
- ASAN_OPTIONS=abort_on_error=1:fast_unwind_on_malloc=0:detect_leaks=0 UBSAN_OPTIONS=print_stacktrace=1 make check V=1
test_scan_build_clang:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
parallel:
matrix:
- CONFIGURE_ARGS: [ --enable-elements=no, --enable-elements=no --enable-minimal=yes, "", --enable-minimal=yes ]
tags:
- ga
script:
- ./tools/cleanup.sh && ./tools/autogen.sh
- CC=clang scan-build-11 ./configure --enable-export-all --enable-swig-python --enable-swig-java --disable-clear-tests --disable-asm $CONFIGURE_ARGS
- scan-build-11 --keep-cc --exclude src/secp256k1/ --status-bugs --keep-empty -o scan-build-output make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
artifacts:
expire_in: 3 days
name: scan-build-output
when: on_success
paths:
- scan-build-output/
test_cmake:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
tags:
- ga
script:
- mv _cmake cmake
- mv _CMakeLists.txt CMakeLists.txt
- mv src/_CMakeLists.txt src/CMakeLists.txt
- mv src/ctest/_CMakeLists.txt src/ctest/CMakeLists.txt
- cmake -B build-cmake -S .
-DBUILD_SHARED_LIBS:BOOL=FALSE
-DCMAKE_BUILD_TYPE:STRING=Debug
-DWALLYCORE_ENABLE_TESTS:BOOL=TRUE
-DWALLYCORE_ENABLE_COVERAGE:BOOL=TRUE
- cmake --build build-cmake
#- ctest --test-dir build-cmake --output-junit report.xml --output-on-failure -E "test_(clear|elements_tx)"
- cd build-cmake
- ctest --output-on-failure
- cd -
- pip install gcovr
- gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml --root ${CI_PROJECT_DIR}
coverage: /^\s*lines:\s*\d+.\d+\%/
artifacts:
reports:
# junit: build-cmake/report.xml # junit report generation not available in cmake 3.18
coverage_report:
coverage_format: cobertura
path: coverage.xml
test_amalgamation:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
parallel:
matrix:
- CC: [gcc, clang ]
BUILD_ARGS: [ "", -DBUILD_MINIMAL, -DBUILD_ELEMENTS, -DBUILD_ELEMENTS -DBUILD_MINIMAL ]
tags:
- ga
script:
- touch config.h
- $CC $BUILD_ARGS -Wall -W -Wextra -Werror -I. -I./src -I./src/ccan -I./src/secp256k1/include src/ctest/amalgamation_compile_test.c
test_mingw_static_build:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
tags:
- ga
script:
- ./tools/cleanup.sh && ./tools/autogen.sh
- CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32 --disable-swig-python --disable-swig-java --disable-shared --enable-static
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
test_no_elements_abi:
stage: test
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
tags:
- ga
artifacts:
script:
- ./tools/cleanup.sh && ./tools/autogen.sh
- CFLAGS='-Wall -W -Wextra -Werror' ./configure --disable-swig-python --disable-swig-java --disable-clear-tests --enable-elements=no --enable-elements-abi=no
- make -j $(($(grep ^processor /proc/cpuinfo | wc -l) / 2))
build_wally_release_files:
stage: release
needs: [test_mingw_static_build,test_with_valgrind,test_asan_ubsan_gcc,test_scan_build_clang,test_cmake,test_amalgamation]
image: greenaddress/wallycore@sha256:956b107d688f549c6e3884424991b7d3d34d84173990d43046fd760d7918db7c
artifacts:
expire_in: 7 days
name: wallycore-bindings
when: on_success
paths:
- dist/*
tags:
- ga
script:
- python3 -m build
- virtualenv -p python3 .smoketest
- source .smoketest/bin/activate
- pip install --find-links=./dist wallycore
- python -c "import wallycore as w; assert w.hex_from_bytes(w.hex_to_bytes('ff')) == 'ff'"
- deactivate
- rm -rf .smoketest dist/*.whl
- mv dist wally_dist
- ./tools/build_android_libraries.sh
- mv release wallycore-android-jni
- tar czf wally_dist/wallycore-android-jni.tar.gz --remove-files wallycore-android-jni
- source /opt/emsdk/emsdk_env.sh
- tools/build_wasm.sh
- cp contrib/wally_js_example.html dist/wallycore.html
- cd dist
- tar czf ../wally_dist/wallycore-wasm.tar.gz --remove-files wallycore.html wallycore.js wallycore.wasm
- cd ..
- EMCC_OPTIONS="-s MODULARIZE=1 -s EXPORT_NAME=InitWally" EXPORTED_FUNCTIONS="['_malloc','_free','_wally_init','_wally_asset_value_commitment','_wally_asset_generator_from_bytes']" tools/build_wasm.sh
- cd dist
- tar czf ../wally_dist/esplora-wasm.tar.gz --remove-files wallycore.js wallycore.wasm
- cd ..
- sphinx-build -b html -a -c docs/source docs/source docs/build/html
- cd docs/build
- tar czf ../../wally_dist/apidocs.tar.gz html/
- cd ../..
- mv wally_dist/* dist/
- rmdir wally_dist