Skip to content

Commit 1744fb2

Browse files
real-or-randomFabcien
authored andcommitted
[SECP256K1] Add support for Cirrus CI
Summary: Switch from Travis to Cirrus as a CI for libsecp256k1. Backport of [[bitcoin-core/secp256k1#864 | secp256k1#864]] The files have been adapted to match our codebase: - The build_autotools.sh and build_cmake.sh scripts are reused from the Travis setup. - The nixos base file is removed since it would build openjdk from source for i686 and time out. This is not a good move but these files will be removed in a follow-up diff anyway, so not a big deal. - Skip JNI tests on macOS, since Java is not installed on Cirrus macOS VM. - Work around valgrind install path not being searched by CMake. This is a known CMake issue (/usr/local/include should be part of the system search path for headers): https://gitlab.kitware.com/cmake/cmake/-/issues/19120 - Increase the timeouts, since we are running each test twice the valgrind task will not complete in 1h on macOS. Test Plan: See result from my own repo: https://cirrus-ci.com/build/6029790437179392 Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D9397
1 parent 13f5ffe commit 1744fb2

File tree

9 files changed

+427
-122
lines changed

9 files changed

+427
-122
lines changed

.cirrus.yml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
env:
2+
WIDEMUL: auto
3+
BIGNUM: gmp
4+
STATICPRECOMPUTATION: yes
5+
ECMULTGENPRECISION: auto
6+
ASM: no
7+
AUTOTOOLS_TARGET: check
8+
CMAKE_TARGET: check-secp256k1
9+
AUTOTOOLS_EXTRA_FLAGS:
10+
CMAKE_EXTRA_FLAGS:
11+
WITH_VALGRIND: yes
12+
RUN_VALGRIND: no
13+
HOST:
14+
ECDH: no
15+
RECOVERY: no
16+
SCHNORR: yes
17+
SCHNORRSIG: no
18+
EXPERIMENTAL: no
19+
JNI: no
20+
OPENSSL_TESTS: auto
21+
MULTISET: no
22+
CTIMETEST: yes
23+
BENCH: yes
24+
ITERS: 2
25+
# We only need the top commit
26+
CIRRUS_CLONE_DEPTH: 1
27+
28+
cat_logs_snippet: &CAT_LOGS
29+
on_failure:
30+
debug_output_script:
31+
- cat config.log || true
32+
- cat test_env.log || true
33+
- env
34+
35+
task:
36+
timeout_in: 120m
37+
name: "x86_64: Linux (Alpine Linux, Nix Shell)"
38+
container:
39+
dockerfile: ci/linux-nixos.Dockerfile
40+
# Reduce number of CPUs to be able to do more builds in parallel.
41+
cpu: 1
42+
# More than enough for our scripts.
43+
memory: 1G
44+
matrix: &ENV_MATRIX
45+
- env: {WIDEMUL: int64, RECOVERY: yes}
46+
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
47+
- env: {WIDEMUL: int128}
48+
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
49+
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
50+
- env: {WIDEMUL: int128, ASM: x86_64}
51+
- env: {BIGNUM: no}
52+
- env: {BIGNUM: no, RECOVERY: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
53+
- env: {BIGNUM: no, STATICPRECOMPUTATION: no}
54+
- env: {AUTOTOOLS_TARGET: distcheck, CMAKE_TARGET: install, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
55+
- env: {AUTOTOOLS_EXTRA_FLAGS: CPPFLAGS=-DDETERMINISTIC, CMAKE_EXTRA_FLAGS: -DCMAKE_C_FLAGS=-DDETERMINISTIC}
56+
- env: {AUTOTOOLS_EXTRA_FLAGS: CFLAGS=-O0, CMAKE_EXTRA_FLAGS: -DCMAKE_BUILD_TYPE=Debug, CTIMETEST: no}
57+
- env: {AUTOTOOLS_TARGET: check-java, CMAKE_TARGET: check-secp256k1-java, JNI: yes, ECDH: yes, EXPERIMENTAL: yes, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
58+
# The Cirrus macOS VM has no java installed
59+
only_if: $CIRRUS_OS == 'linux'
60+
- env: {SCHNORR: no}
61+
- env:
62+
CFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
63+
LDFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
64+
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
65+
BIGNUM: no
66+
ASM: x86_64
67+
ECDH: yes
68+
RECOVERY: yes
69+
EXPERIMENTAL: yes
70+
MULTISET: yes
71+
SCHNORRSIG: yes
72+
CTIMETEST: no
73+
- env: { ECMULTGENPRECISION: 2 }
74+
- env: { ECMULTGENPRECISION: 8 }
75+
- env:
76+
RUN_VALGRIND: yes
77+
BIGNUM: no
78+
ASM: x86_64
79+
ECDH: yes
80+
RECOVERY: yes
81+
EXPERIMENTAL: yes
82+
MULTISET: yes
83+
SCHNORRSIG: yes
84+
OPENSSL_TESTS: no
85+
AUTOTOOLS_TARGET:
86+
CMAKE_TARGET: "secp256k1-tests secp256k1-exhaustive_tests"
87+
matrix:
88+
- env:
89+
CC: gcc
90+
- env:
91+
CC: clang
92+
test_script:
93+
- nix-shell ci/shell.nix --run ./ci/build_autotools.sh
94+
- nix-shell ci/shell.nix --run ./ci/build_cmake.sh
95+
<< : *CAT_LOGS
96+
97+
task:
98+
name: "i686: Linux (Alpine Linux, Nix Shell)"
99+
container:
100+
dockerfile: ci/linux-nixos.Dockerfile
101+
cpu: 1
102+
memory: 1G
103+
env:
104+
HOST: i686-linux-gnu
105+
ECDH: yes
106+
RECOVERY: yes
107+
EXPERIMENTAL: yes
108+
SCHNORRSIG: yes
109+
OPENSSL_TESTS: no
110+
matrix:
111+
- env:
112+
CC: gcc
113+
- env:
114+
CC: clang
115+
matrix:
116+
- env:
117+
BIGNUM: gmp
118+
- env:
119+
BIGNUM: no
120+
test_script:
121+
- nix-shell ci/shell-i686.nix --run ./ci/build_autotools.sh
122+
- nix-shell ci/shell-i686.nix --run ./ci/build_cmake.sh
123+
<< : *CAT_LOGS
124+
125+
task:
126+
timeout_in: 120m
127+
name: "x86_64: macOS Catalina"
128+
macos_instance:
129+
image: catalina-base
130+
env:
131+
HOMEBREW_NO_AUTO_UPDATE: 1
132+
HOMEBREW_NO_INSTALL_CLEANUP: 1
133+
matrix:
134+
<< : *ENV_MATRIX
135+
matrix:
136+
- env:
137+
CC: gcc-9
138+
- env:
139+
CC: clang
140+
# Update Command Line Tools
141+
# Uncomment this if the Command Line Tools on the CirrusCI macOS image are too old to brew valgrind.
142+
# See https://apple.stackexchange.com/a/195963 for the implementation.
143+
## update_clt_script:
144+
## - system_profiler SPSoftwareDataType
145+
## - touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
146+
## - |-
147+
## PROD=$(softwareupdate -l | grep "*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | sed 's/Label: //g' | tr -d '\n')
148+
## # For debugging
149+
## - softwareupdate -l && echo "PROD: $PROD"
150+
## - softwareupdate -i "$PROD" --verbose
151+
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
152+
##
153+
brew_valgrind_pre_script:
154+
- brew config
155+
- brew tap --shallow LouisBrunner/valgrind
156+
# Fetch valgrind source but don't build it yet.
157+
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
158+
brew_valgrind_cache:
159+
# This is $(brew --cellar valgrind) but command substition does not work here.
160+
folder: /usr/local/Cellar/valgrind
161+
# Rebuild cache if ...
162+
fingerprint_script:
163+
# ... macOS version changes:
164+
- sw_vers
165+
# ... brew changes:
166+
- brew config
167+
# ... valgrind changes:
168+
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
169+
populate_script:
170+
# If there's no hit in the cache, build and install valgrind.
171+
- brew install --HEAD LouisBrunner/valgrind/valgrind
172+
brew_valgrind_post_script:
173+
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
174+
# If we haven't restored from cached (and just run brew install), this is a no-op.
175+
- brew link valgrind
176+
brew_script:
177+
- brew install automake cmake gcc@9 gmp libtool ninja
178+
test_script:
179+
- ./ci/build_autotools.sh
180+
- ./ci/build_cmake.sh
181+
<< : *CAT_LOGS
182+
183+
task:
184+
name: "s390x (big-endian): Linux (Debian QEMU)"
185+
container:
186+
dockerfile: ci/linux-debian-s390-qemu.Dockerfile
187+
cpu: 1
188+
memory: 1G
189+
env:
190+
QEMU_CMD: qemu-s390x
191+
HOST: s390x-linux-gnu
192+
WITH_VALGRIND: no
193+
BIGNUM: no
194+
ECDH: yes
195+
RECOVERY: yes
196+
EXPERIMENTAL: yes
197+
MULTISET: yes
198+
SCHNORRSIG: yes
199+
OPENSSL_TESTS: no
200+
CTIMETEST: no
201+
AUTOTOOLS_TARGET:
202+
test_script:
203+
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
204+
- rm /etc/ld.so.cache
205+
- ./ci/build_autotools.sh
206+
<< : *CAT_LOGS

.travis.yml

Lines changed: 0 additions & 121 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
libsecp256k1
22
============
33

4-
[![Build Status](https://travis-ci.org/bitcoin-abc/secp256k1.svg?branch=master)](https://travis-ci.org/bitcoin-abc/secp256k1)
4+
[![Build Status](https://api.cirrus-ci.com/github/bitcoin-abc/secp256k1.svg?branch=master)](https://cirrus-ci.com/github/bitcoin-abc/secp256k1)
55

66
Optimized C library for cryptographic operations on curve secp256k1.
77

0 commit comments

Comments
 (0)