Skip to content

Commit 776e30a

Browse files
Add support for Cirrus CI
1 parent 3c15130 commit 776e30a

File tree

9 files changed

+292
-1
lines changed

9 files changed

+292
-1
lines changed

.cirrus.yml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
env:
2+
WIDEMUL: auto
3+
BIGNUM: auto
4+
STATICPRECOMPUTATION: yes
5+
ECMULTGENPRECISION: auto
6+
ASM: no
7+
BUILD: check
8+
WITH_VALGRIND: yes
9+
RUN_VALGRIND: no
10+
EXTRAFLAGS:
11+
HOST:
12+
ECDH: no
13+
RECOVERY: no
14+
SCHNORRSIG: no
15+
EXPERIMENTAL: no
16+
CTIMETEST: yes
17+
BENCH: yes
18+
ITERS: 2
19+
# We only need the top commit
20+
CIRRUS_CLONE_DEPTH: 1
21+
22+
cat_logs_snippet: &CAT_LOGS
23+
always:
24+
test_logs_script:
25+
- cat tests.log || true
26+
- cat exhaustive_tests.log || true
27+
- cat valgrind_ctime_test.log || true
28+
- cat bench.log || true
29+
on_failure:
30+
debug_output_script:
31+
- cat config.log || true
32+
- cat test_env.log || true
33+
- env
34+
35+
docker_arg_force_build_snippet: &DOCKER_ARGS_FORCE_REBUILD
36+
docker_arguments:
37+
# Add build id to the key of the Docker cache in order to force rebuild of Docker image for every build.
38+
# See https://github.com/cirruslabs/cirrus-ci-docs/issues/692#issuecomment-756359992 .
39+
- DUMMY: $CIRRUS_BUILD_ID
40+
41+
task:
42+
name: "x86_64: Linux (NixOS Shell)"
43+
container:
44+
dockerfile: ci/linux-nixos.Dockerfile
45+
<< : *DOCKER_ARGS_FORCE_REBUILD
46+
# Reduce number of CPUs to be able to do more builds in parallel.
47+
cpu: 1
48+
# More than enough for our scripts.
49+
memory: 1G
50+
matrix: &ENV_MATRIX
51+
- env: {WIDEMUL: int64, RECOVERY: yes}
52+
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
53+
- env: {WIDEMUL: int128}
54+
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
55+
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
56+
- env: {WIDEMUL: int128, ASM: x86_64}
57+
- env: {BIGNUM: no}
58+
- env: {BIGNUM: no, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
59+
- env: {BIGNUM: no, STATICPRECOMPUTATION: no}
60+
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
61+
- env: {CPPFLAGS: -DDETERMINISTIC}
62+
- env: {CFLAGS: -O0, CTIMETEST: no}
63+
- env:
64+
CFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
65+
LDFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
66+
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
67+
BIGNUM: no
68+
ASM: x86_64
69+
ECDH: yes
70+
RECOVERY: yes
71+
EXPERIMENTAL: yes
72+
SCHNORRSIG: yes
73+
CTIMETEST: no
74+
- env: { ECMULTGENPRECISION: 2 }
75+
- env: { ECMULTGENPRECISION: 8 }
76+
- env:
77+
RUN_VALGRIND: yes
78+
BIGNUM: no
79+
ASM: x86_64
80+
ECDH: yes
81+
RECOVERY: yes
82+
EXPERIMENTAL: yes
83+
SCHNORRSIG: yes
84+
EXTRAFLAGS: "--disable-openssl-tests"
85+
BUILD:
86+
matrix:
87+
- env:
88+
CC: gcc
89+
- env:
90+
CC: clang
91+
test_script:
92+
- nix-shell -I channel:nixos-unstable ci/shell.nix --run ./ci/cirrus.sh
93+
<< : *CAT_LOGS
94+
95+
task:
96+
name: "i686: Linux (NixOS Shell)"
97+
container:
98+
dockerfile: ci/linux-nixos.Dockerfile
99+
<< : *DOCKER_ARGS_FORCE_REBUILD
100+
cpu: 1
101+
memory: 1G
102+
env:
103+
HOST: i686-linux-gnu
104+
ECDH: yes
105+
RECOVERY: yes
106+
EXPERIMENTAL: yes
107+
SCHNORRSIG: yes
108+
matrix:
109+
- env:
110+
CC: gcc
111+
- env:
112+
CC: clang
113+
matrix:
114+
- env:
115+
BIGNUM: gmp
116+
- env:
117+
BIGNUM: no
118+
test_script:
119+
- nix-shell -I channel:nixos-unstable ci/shell-i686.nix --run ./ci/cirrus.sh
120+
<< : *CAT_LOGS
121+
122+
task:
123+
name: "x86_64: macOS Catalina"
124+
macos_instance:
125+
image: catalina-base
126+
matrix:
127+
<< : *ENV_MATRIX
128+
matrix:
129+
- env:
130+
CC: gcc-9
131+
- env:
132+
CC: clang
133+
# Update Command Line Tools
134+
# Uncomment this if the Command Line Tools on the CirrusCI macOS image are too old to brew valgrind.
135+
# See https://apple.stackexchange.com/a/195963 for the implementation.
136+
## update_clt_script:
137+
## - system_profiler SPSoftwareDataType
138+
## - touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
139+
## - |-
140+
## PROD=$(softwareupdate -l | grep "*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | sed 's/Label: //g' | tr -d '\n')
141+
## # For debugging
142+
## - softwareupdate -l && echo "PROD: $PROD"
143+
## - softwareupdate -i "$PROD" --verbose
144+
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
145+
##
146+
brew_script:
147+
# TODO cache the binaries
148+
- export HOMEBREW_NO_AUTO_UPDATE=1
149+
- export HOMEBREW_NO_INSTALL_CLEANUP=1
150+
- brew config
151+
- brew tap LouisBrunner/valgrind
152+
- brew install --HEAD LouisBrunner/valgrind/valgrind
153+
- brew install gmp gcc@9
154+
test_script:
155+
- ./ci/cirrus.sh
156+
<< : *CAT_LOGS
157+
158+
task:
159+
name: "s390x (big-endian): Linux (Debian QEMU)"
160+
container:
161+
dockerfile: ci/linux-debian-s390-qemu.Dockerfile
162+
<< : *DOCKER_ARGS_FORCE_REBUILD
163+
cpu: 1
164+
memory: 1G
165+
env:
166+
QEMU_CMD: qemu-s390x
167+
HOST: s390x-linux-gnu
168+
BUILD:
169+
WITH_VALGRIND: no
170+
BIGNUM: no
171+
ECDH: yes
172+
RECOVERY: yes
173+
EXPERIMENTAL: yes
174+
SCHNORRSIG: yes
175+
CTIMETEST: no
176+
test_script:
177+
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
178+
- rm /etc/ld.so.cache
179+
- ./ci/cirrus.sh
180+
<< : *CAT_LOGS

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ before_script: ./autogen.sh
9797
script:
9898
- function keep_alive() { while true; do echo -en "\a"; sleep 60; done }
9999
- keep_alive &
100-
- ./contrib/travis.sh
100+
- ./ci/travis.sh
101101
- kill %keep_alive
102102

103103
after_script:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ libsecp256k1
22
============
33

44
[![Build Status](https://travis-ci.org/bitcoin-core/secp256k1.svg?branch=master)](https://travis-ci.org/bitcoin-core/secp256k1)
5+
[![Build Status](https://api.cirrus-ci.com/github/bitcoin-core/secp256k1.svg?branch=master)](https://cirrus-ci.com/github/bitcoin-core/secp256k1)
56

67
Optimized C library for ECDSA signatures and secret/public key operations on curve secp256k1.
78

ci/cirrus.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -x
5+
6+
export LC_ALL=C
7+
8+
env >> test_env.log
9+
10+
$CC -v || true
11+
valgrind --version || true
12+
13+
./autogen.sh
14+
15+
# NixOS doesn't store GNU file in /usr/bin, see https://lists.gnu.org/archive/html/bug-libtool/2015-09/msg00000.html .
16+
# The -i'' is necessary for macOS portability, see https://stackoverflow.com/a/4247319 .
17+
sed -i'' -e 's@/usr/bin/file@$(which file)@g' configure
18+
19+
./configure \
20+
--enable-experimental="$EXPERIMENTAL" \
21+
--with-test-override-wide-multiply="$WIDEMUL" --with-bignum="$BIGNUM" --with-asm="$ASM" \
22+
--enable-ecmult-static-precomputation="$STATICPRECOMPUTATION" --with-ecmult-gen-precision="$ECMULTGENPRECISION" \
23+
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
24+
--enable-module-schnorrsig="$SCHNORRSIG" \
25+
--with-valgrind="$WITH_VALGRIND" \
26+
--host="$HOST" $EXTRAFLAGS
27+
28+
if [ -n "$BUILD" ]
29+
then
30+
make -j2 "$BUILD"
31+
fi
32+
33+
if [ "$RUN_VALGRIND" = "yes" ]
34+
then
35+
make -j2
36+
# the `--error-exitcode` is required to make the test fail if valgrind found errors, otherwise it'll return 0 (http://valgrind.org/docs/manual/manual-core.html)
37+
valgrind --error-exitcode=42 ./tests 16
38+
valgrind --error-exitcode=42 ./exhaustive_tests
39+
fi
40+
41+
if [ -n "$QEMU_CMD" ]
42+
then
43+
make -j2
44+
$QEMU_CMD ./tests 16
45+
$QEMU_CMD ./exhaustive_tests
46+
fi
47+
48+
if [ "$BENCH" = "yes" ]
49+
then
50+
EXEC='./libtool --mode=execute'
51+
if [ -n "$QEMU_CMD" ]
52+
then
53+
EXEC="$EXEC $QEMU_CMD"
54+
fi
55+
if [ "$RUN_VALGRIND" = "yes" ]
56+
then
57+
# Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool
58+
EXEC="$EXEC valgrind --error-exitcode=42"
59+
fi
60+
# This limits the iterations in the benchmarks below to ITER(set in .travis.yml) iterations.
61+
export SECP256K1_BENCH_ITERS="$ITERS"
62+
{
63+
$EXEC ./bench_ecmult
64+
$EXEC ./bench_internal
65+
$EXEC ./bench_sign
66+
$EXEC ./bench_verify
67+
} >> bench.log 2>&1
68+
if [ "$RECOVERY" = "yes" ]
69+
then
70+
$EXEC ./bench_recover >> bench.log 2>&1
71+
fi
72+
if [ "$ECDH" = "yes" ]
73+
then
74+
$EXEC ./bench_ecdh >> bench.log 2>&1
75+
fi
76+
if [ "$SCHNORRSIG" = "yes" ]
77+
then
78+
$EXEC ./bench_schnorrsig >> bench.log 2>&1
79+
fi
80+
fi
81+
if [ "$CTIMETEST" = "yes" ]
82+
then
83+
./libtool --mode=execute valgrind --error-exitcode=42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>&1
84+
fi

ci/linux-debian-s390-qemu.Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM debian
2+
3+
RUN dpkg --add-architecture s390x
4+
RUN apt-get update
5+
RUN apt-get install --no-install-recommends --no-upgrade -y make automake libtool
6+
RUN apt-get install --no-install-recommends --no-upgrade -y gcc-s390x-linux-gnu libc6-dev-s390x-cross qemu-user libc6:s390x

ci/linux-nixos.Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM nixos/nix
2+
3+
COPY ci/shell.nix /tmp
4+
COPY ci/shell-i686.nix /tmp
5+
6+
# Run dummy command "true" in the nix-shell just to get the packages prepared.
7+
RUN nix-shell -I channel:nixos-unstable /tmp/shell.nix --command true
8+
RUN nix-shell -I channel:nixos-unstable /tmp/shell-i686.nix --command true

ci/shell-i686.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with (import <nixpkgs> {}).pkgsi686Linux;
2+
mkShell {
3+
buildInputs = [
4+
bash file pkgconfig autoconf automake libtool gmp valgrind clang gcc
5+
];
6+
}

ci/shell.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with (import <nixpkgs> {});
2+
mkShell {
3+
buildInputs = [
4+
bash file pkgconfig autoconf automake libtool gmp valgrind clang gcc
5+
];
6+
}
File renamed without changes.

0 commit comments

Comments
 (0)