Skip to content

Commit 128af08

Browse files
feat: add CI workflow for Linux and macOS builds
1 parent c20339d commit 128af08

5 files changed

Lines changed: 451 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
build-linux:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
submodules: recursive
18+
19+
- name: Install dependencies
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y build-essential autoconf automake libtool pkg-config
23+
24+
- name: Generate configure
25+
run: ./autogen.sh
26+
27+
- name: Configure with Radiant support
28+
run: ./configure --enable-rxd
29+
30+
- name: Build
31+
run: make -j$(nproc)
32+
33+
- name: Run tests
34+
run: make check
35+
continue-on-error: true
36+
37+
build-macos:
38+
runs-on: macos-latest
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
with:
44+
submodules: recursive
45+
46+
- name: Install dependencies
47+
run: |
48+
brew install autoconf automake libtool pkg-config
49+
50+
- name: Generate configure
51+
run: ./autogen.sh
52+
53+
- name: Configure with Radiant support
54+
run: ./configure --enable-rxd
55+
56+
- name: Build
57+
run: make -j$(sysctl -n hw.ncpu)
58+
59+
- name: Run tests
60+
run: make check
61+
continue-on-error: true

rxdeb

1.55 MB
Binary file not shown.

secp256k1/.cirrus.yml

Lines changed: 326 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,326 @@
1+
env:
2+
### compiler options
3+
HOST:
4+
# Specific warnings can be disabled with -Wno-error=foo.
5+
# -pedantic-errors is not equivalent to -Werror=pedantic and thus not implied by -Werror according to the GCC manual.
6+
WERROR_CFLAGS: -Werror -pedantic-errors
7+
MAKEFLAGS: -j4
8+
BUILD: check
9+
### secp256k1 config
10+
ECMULTWINDOW: auto
11+
ECMULTGENPRECISION: auto
12+
ASM: no
13+
WIDEMUL: auto
14+
WITH_VALGRIND: yes
15+
EXTRAFLAGS:
16+
### secp256k1 modules
17+
EXPERIMENTAL: no
18+
ECDH: no
19+
RECOVERY: no
20+
SCHNORRSIG: no
21+
### test options
22+
SECP256K1_TEST_ITERS:
23+
BENCH: yes
24+
SECP256K1_BENCH_ITERS: 2
25+
CTIMETEST: yes
26+
# Compile and run the tests
27+
EXAMPLES: yes
28+
29+
cat_logs_snippet: &CAT_LOGS
30+
always:
31+
cat_tests_log_script:
32+
- cat tests.log || true
33+
cat_exhaustive_tests_log_script:
34+
- cat exhaustive_tests.log || true
35+
cat_valgrind_ctime_test_log_script:
36+
- cat valgrind_ctime_test.log || true
37+
cat_bench_log_script:
38+
- cat bench.log || true
39+
on_failure:
40+
cat_config_log_script:
41+
- cat config.log || true
42+
cat_test_env_script:
43+
- cat test_env.log || true
44+
cat_ci_env_script:
45+
- env
46+
47+
merge_base_script_snippet: &MERGE_BASE
48+
merge_base_script:
49+
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
50+
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
51+
- git config --global user.email "ci@ci.ci"
52+
- git config --global user.name "ci"
53+
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
54+
55+
linux_container_snippet: &LINUX_CONTAINER
56+
container:
57+
dockerfile: ci/linux-debian.Dockerfile
58+
# Reduce number of CPUs to be able to do more builds in parallel.
59+
cpu: 1
60+
# Gives us more CPUs for free if they're available.
61+
greedy: true
62+
# More than enough for our scripts.
63+
memory: 1G
64+
65+
task:
66+
name: "x86_64: Linux (Debian stable)"
67+
<< : *LINUX_CONTAINER
68+
matrix: &ENV_MATRIX
69+
- env: {WIDEMUL: int64, RECOVERY: yes}
70+
- env: {WIDEMUL: int64, ECDH: yes, SCHNORRSIG: yes}
71+
- env: {WIDEMUL: int128}
72+
- env: {WIDEMUL: int128, RECOVERY: yes, SCHNORRSIG: yes}
73+
- env: {WIDEMUL: int128, ECDH: yes, SCHNORRSIG: yes}
74+
- env: {WIDEMUL: int128, ASM: x86_64}
75+
- env: { RECOVERY: yes, SCHNORRSIG: yes}
76+
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
77+
- env: {CPPFLAGS: -DDETERMINISTIC}
78+
- env: {CFLAGS: -O0, CTIMETEST: no}
79+
- env: { ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
80+
- env: { ECMULTGENPRECISION: 8, ECMULTWINDOW: 4 }
81+
matrix:
82+
- env:
83+
CC: gcc
84+
- env:
85+
CC: clang
86+
<< : *MERGE_BASE
87+
test_script:
88+
- ./ci/cirrus.sh
89+
<< : *CAT_LOGS
90+
91+
task:
92+
name: "i686: Linux (Debian stable)"
93+
<< : *LINUX_CONTAINER
94+
env:
95+
HOST: i686-linux-gnu
96+
ECDH: yes
97+
RECOVERY: yes
98+
SCHNORRSIG: yes
99+
matrix:
100+
- env:
101+
CC: i686-linux-gnu-gcc
102+
- env:
103+
CC: clang --target=i686-pc-linux-gnu -isystem /usr/i686-linux-gnu/include
104+
<< : *MERGE_BASE
105+
test_script:
106+
- ./ci/cirrus.sh
107+
<< : *CAT_LOGS
108+
109+
task:
110+
name: "x86_64: macOS Catalina"
111+
macos_instance:
112+
image: catalina-base
113+
env:
114+
HOMEBREW_NO_AUTO_UPDATE: 1
115+
HOMEBREW_NO_INSTALL_CLEANUP: 1
116+
# Cirrus gives us a fixed number of 12 virtual CPUs. Not that we even have that many jobs at the moment...
117+
MAKEFLAGS: -j13
118+
matrix:
119+
<< : *ENV_MATRIX
120+
matrix:
121+
- env:
122+
CC: gcc-9
123+
- env:
124+
CC: clang
125+
# Update Command Line Tools
126+
# Uncomment this if the Command Line Tools on the CirrusCI macOS image are too old to brew valgrind.
127+
# See https://apple.stackexchange.com/a/195963 for the implementation.
128+
## update_clt_script:
129+
## - system_profiler SPSoftwareDataType
130+
## - touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
131+
## - |-
132+
## PROD=$(softwareupdate -l | grep "*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | sed 's/Label: //g' | tr -d '\n')
133+
## # For debugging
134+
## - softwareupdate -l && echo "PROD: $PROD"
135+
## - softwareupdate -i "$PROD" --verbose
136+
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
137+
##
138+
brew_valgrind_pre_script:
139+
# Retry a few times because this tends to fail randomly.
140+
- for i in {1..5}; do brew update && break || sleep 15; done
141+
- brew config
142+
- brew tap LouisBrunner/valgrind
143+
# Fetch valgrind source but don't build it yet.
144+
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
145+
brew_valgrind_cache:
146+
# This is $(brew --cellar valgrind) but command substition does not work here.
147+
folder: /usr/local/Cellar/valgrind
148+
# Rebuild cache if ...
149+
fingerprint_script:
150+
# ... macOS version changes:
151+
- sw_vers
152+
# ... brew changes:
153+
- brew config
154+
# ... valgrind changes:
155+
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
156+
populate_script:
157+
# If there's no hit in the cache, build and install valgrind.
158+
- brew install --HEAD LouisBrunner/valgrind/valgrind
159+
brew_valgrind_post_script:
160+
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
161+
# If we haven't restored from cached (and just run brew install), this is a no-op.
162+
- brew link valgrind
163+
brew_script:
164+
- brew install automake libtool gcc@9
165+
<< : *MERGE_BASE
166+
test_script:
167+
- ./ci/cirrus.sh
168+
<< : *CAT_LOGS
169+
170+
task:
171+
name: "s390x (big-endian): Linux (Debian stable, QEMU)"
172+
<< : *LINUX_CONTAINER
173+
env:
174+
WRAPPER_CMD: qemu-s390x
175+
SECP256K1_TEST_ITERS: 16
176+
HOST: s390x-linux-gnu
177+
WITH_VALGRIND: no
178+
ECDH: yes
179+
RECOVERY: yes
180+
SCHNORRSIG: yes
181+
CTIMETEST: no
182+
<< : *MERGE_BASE
183+
test_script:
184+
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
185+
- rm /etc/ld.so.cache
186+
- ./ci/cirrus.sh
187+
<< : *CAT_LOGS
188+
189+
task:
190+
name: "ARM32: Linux (Debian stable, QEMU)"
191+
<< : *LINUX_CONTAINER
192+
env:
193+
WRAPPER_CMD: qemu-arm
194+
SECP256K1_TEST_ITERS: 16
195+
HOST: arm-linux-gnueabihf
196+
WITH_VALGRIND: no
197+
ECDH: yes
198+
RECOVERY: yes
199+
SCHNORRSIG: yes
200+
CTIMETEST: no
201+
matrix:
202+
- env: {}
203+
- env: {EXPERIMENTAL: yes, ASM: arm}
204+
<< : *MERGE_BASE
205+
test_script:
206+
- ./ci/cirrus.sh
207+
<< : *CAT_LOGS
208+
209+
task:
210+
name: "ARM64: Linux (Debian stable, QEMU)"
211+
<< : *LINUX_CONTAINER
212+
env:
213+
WRAPPER_CMD: qemu-aarch64
214+
SECP256K1_TEST_ITERS: 16
215+
HOST: aarch64-linux-gnu
216+
WITH_VALGRIND: no
217+
ECDH: yes
218+
RECOVERY: yes
219+
SCHNORRSIG: yes
220+
CTIMETEST: no
221+
<< : *MERGE_BASE
222+
test_script:
223+
- ./ci/cirrus.sh
224+
<< : *CAT_LOGS
225+
226+
task:
227+
name: "ppc64le: Linux (Debian stable, QEMU)"
228+
<< : *LINUX_CONTAINER
229+
env:
230+
WRAPPER_CMD: qemu-ppc64le
231+
SECP256K1_TEST_ITERS: 16
232+
HOST: powerpc64le-linux-gnu
233+
WITH_VALGRIND: no
234+
ECDH: yes
235+
RECOVERY: yes
236+
SCHNORRSIG: yes
237+
CTIMETEST: no
238+
<< : *MERGE_BASE
239+
test_script:
240+
- ./ci/cirrus.sh
241+
<< : *CAT_LOGS
242+
243+
task:
244+
name: "x86_64 (mingw32-w64): Windows (Debian stable, Wine)"
245+
<< : *LINUX_CONTAINER
246+
env:
247+
WRAPPER_CMD: wine64-stable
248+
SECP256K1_TEST_ITERS: 16
249+
HOST: x86_64-w64-mingw32
250+
WITH_VALGRIND: no
251+
ECDH: yes
252+
RECOVERY: yes
253+
SCHNORRSIG: yes
254+
CTIMETEST: no
255+
<< : *MERGE_BASE
256+
test_script:
257+
- ./ci/cirrus.sh
258+
<< : *CAT_LOGS
259+
260+
# Sanitizers
261+
task:
262+
<< : *LINUX_CONTAINER
263+
env:
264+
ECDH: yes
265+
RECOVERY: yes
266+
SCHNORRSIG: yes
267+
CTIMETEST: no
268+
matrix:
269+
- name: "Valgrind (memcheck)"
270+
container:
271+
cpu: 2
272+
env:
273+
# The `--error-exitcode` is required to make the test fail if valgrind found errors, otherwise it'll return 0 (https://www.valgrind.org/docs/manual/manual-core.html)
274+
WRAPPER_CMD: "valgrind --error-exitcode=42"
275+
SECP256K1_TEST_ITERS: 2
276+
- name: "UBSan, ASan, LSan"
277+
container:
278+
memory: 2G
279+
env:
280+
CFLAGS: "-fsanitize=undefined,address -g"
281+
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
282+
ASAN_OPTIONS: "strict_string_checks=1:detect_stack_use_after_return=1:detect_leaks=1"
283+
LSAN_OPTIONS: "use_unaligned=1"
284+
SECP256K1_TEST_ITERS: 32
285+
# Try to cover many configurations with just a tiny matrix.
286+
matrix:
287+
- env:
288+
ASM: auto
289+
- env:
290+
ASM: no
291+
ECMULTGENPRECISION: 2
292+
ECMULTWINDOW: 2
293+
matrix:
294+
- env:
295+
CC: clang
296+
- env:
297+
HOST: i686-linux-gnu
298+
CC: i686-linux-gnu-gcc
299+
<< : *MERGE_BASE
300+
test_script:
301+
- ./ci/cirrus.sh
302+
<< : *CAT_LOGS
303+
304+
task:
305+
name: "C++ -fpermissive"
306+
<< : *LINUX_CONTAINER
307+
env:
308+
# ./configure correctly errors out when given CC=g++.
309+
# We hack around this by passing CC=g++ only to make.
310+
CC: gcc
311+
MAKEFLAGS: -j4 CC=g++ CFLAGS=-fpermissive\ -g
312+
WERROR_CFLAGS:
313+
ECDH: yes
314+
RECOVERY: yes
315+
SCHNORRSIG: yes
316+
<< : *MERGE_BASE
317+
test_script:
318+
- ./ci/cirrus.sh
319+
<< : *CAT_LOGS
320+
321+
task:
322+
name: "sage prover"
323+
<< : *LINUX_CONTAINER
324+
test_script:
325+
- cd sage
326+
- sage prove_group_implementations.sage

0 commit comments

Comments
 (0)