Skip to content

Commit

Permalink
[SECP256K1] Add support for Cirrus CI
Browse files Browse the repository at this point in the history
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
  • Loading branch information
real-or-random authored and Fabcien committed Apr 13, 2021
1 parent 90e09af commit 90f54a4
Show file tree
Hide file tree
Showing 10 changed files with 429 additions and 123 deletions.
3 changes: 2 additions & 1 deletion .arclint
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@
},
"yamllint": {
"type": "yamllint",
"include": "(\\.(yml|yaml)$)"
"include": "(\\.(yml|yaml)$)",
"exclude": "(^src/(secp256k1|univalue|leveldb)/)"
},
"lint-check-nonfatal": {
"type": "lint-check-nonfatal",
Expand Down
206 changes: 206 additions & 0 deletions src/secp256k1/.cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
env:
WIDEMUL: auto
BIGNUM: gmp
STATICPRECOMPUTATION: yes
ECMULTGENPRECISION: auto
ASM: no
AUTOTOOLS_TARGET: check
CMAKE_TARGET: check-secp256k1
AUTOTOOLS_EXTRA_FLAGS:
CMAKE_EXTRA_FLAGS:
WITH_VALGRIND: yes
RUN_VALGRIND: no
HOST:
ECDH: no
RECOVERY: no
SCHNORR: yes
SCHNORRSIG: no
EXPERIMENTAL: no
JNI: no
OPENSSL_TESTS: auto
MULTISET: no
CTIMETEST: yes
BENCH: yes
ITERS: 2
# We only need the top commit
CIRRUS_CLONE_DEPTH: 1

cat_logs_snippet: &CAT_LOGS
on_failure:
debug_output_script:
- cat config.log || true
- cat test_env.log || true
- env

task:
timeout_in: 120m
name: "x86_64: Linux (Alpine Linux, Nix Shell)"
container:
dockerfile: ci/linux-nixos.Dockerfile
# Reduce number of CPUs to be able to do more builds in parallel.
cpu: 1
# More than enough for our scripts.
memory: 1G
matrix: &ENV_MATRIX
- env: {WIDEMUL: int64, RECOVERY: yes}
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128}
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ASM: x86_64}
- env: {BIGNUM: no}
- env: {BIGNUM: no, RECOVERY: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
- env: {BIGNUM: no, STATICPRECOMPUTATION: no}
- env: {AUTOTOOLS_TARGET: distcheck, CMAKE_TARGET: install, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
- env: {AUTOTOOLS_EXTRA_FLAGS: CPPFLAGS=-DDETERMINISTIC, CMAKE_EXTRA_FLAGS: -DCMAKE_C_FLAGS=-DDETERMINISTIC}
- env: {AUTOTOOLS_EXTRA_FLAGS: CFLAGS=-O0, CMAKE_EXTRA_FLAGS: -DCMAKE_BUILD_TYPE=Debug, CTIMETEST: no}
- env: {AUTOTOOLS_TARGET: check-java, CMAKE_TARGET: check-secp256k1-java, JNI: yes, ECDH: yes, EXPERIMENTAL: yes, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
# The Cirrus macOS VM has no java installed
only_if: $CIRRUS_OS == 'linux'
- env: {SCHNORR: no}
- env:
CFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
LDFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
BIGNUM: no
ASM: x86_64
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
MULTISET: yes
SCHNORRSIG: yes
CTIMETEST: no
- env: { ECMULTGENPRECISION: 2 }
- env: { ECMULTGENPRECISION: 8 }
- env:
RUN_VALGRIND: yes
BIGNUM: no
ASM: x86_64
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
MULTISET: yes
SCHNORRSIG: yes
OPENSSL_TESTS: no
AUTOTOOLS_TARGET:
CMAKE_TARGET: "secp256k1-tests secp256k1-exhaustive_tests"
matrix:
- env:
CC: gcc
- env:
CC: clang
test_script:
- nix-shell ci/shell.nix --run ./ci/build_autotools.sh
- nix-shell ci/shell.nix --run ./ci/build_cmake.sh
<< : *CAT_LOGS

task:
name: "i686: Linux (Alpine Linux, Nix Shell)"
container:
dockerfile: ci/linux-nixos.Dockerfile
cpu: 1
memory: 1G
env:
HOST: i686-linux-gnu
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
OPENSSL_TESTS: no
matrix:
- env:
CC: gcc
- env:
CC: clang
matrix:
- env:
BIGNUM: gmp
- env:
BIGNUM: no
test_script:
- nix-shell ci/shell-i686.nix --run ./ci/build_autotools.sh
- nix-shell ci/shell-i686.nix --run ./ci/build_cmake.sh
<< : *CAT_LOGS

task:
timeout_in: 120m
name: "x86_64: macOS Catalina"
macos_instance:
image: catalina-base
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
matrix:
<< : *ENV_MATRIX
matrix:
- env:
CC: gcc-9
- env:
CC: clang
# Update Command Line Tools
# Uncomment this if the Command Line Tools on the CirrusCI macOS image are too old to brew valgrind.
# See https://apple.stackexchange.com/a/195963 for the implementation.
## update_clt_script:
## - system_profiler SPSoftwareDataType
## - touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
## - |-
## PROD=$(softwareupdate -l | grep "*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | sed 's/Label: //g' | tr -d '\n')
## # For debugging
## - softwareupdate -l && echo "PROD: $PROD"
## - softwareupdate -i "$PROD" --verbose
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
##
brew_valgrind_pre_script:
- brew config
- brew tap --shallow LouisBrunner/valgrind
# Fetch valgrind source but don't build it yet.
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
brew_valgrind_cache:
# This is $(brew --cellar valgrind) but command substition does not work here.
folder: /usr/local/Cellar/valgrind
# Rebuild cache if ...
fingerprint_script:
# ... macOS version changes:
- sw_vers
# ... brew changes:
- brew config
# ... valgrind changes:
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
populate_script:
# If there's no hit in the cache, build and install valgrind.
- brew install --HEAD LouisBrunner/valgrind/valgrind
brew_valgrind_post_script:
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
# If we haven't restored from cached (and just run brew install), this is a no-op.
- brew link valgrind
brew_script:
- brew install automake cmake gcc@9 gmp libtool ninja
test_script:
- ./ci/build_autotools.sh
- ./ci/build_cmake.sh
<< : *CAT_LOGS

task:
name: "s390x (big-endian): Linux (Debian QEMU)"
container:
dockerfile: ci/linux-debian-s390-qemu.Dockerfile
cpu: 1
memory: 1G
env:
QEMU_CMD: qemu-s390x
HOST: s390x-linux-gnu
WITH_VALGRIND: no
BIGNUM: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
MULTISET: yes
SCHNORRSIG: yes
OPENSSL_TESTS: no
CTIMETEST: no
AUTOTOOLS_TARGET:
test_script:
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
- rm /etc/ld.so.cache
- ./ci/build_autotools.sh
<< : *CAT_LOGS
121 changes: 0 additions & 121 deletions src/secp256k1/.travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/secp256k1/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
libsecp256k1
============

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

Optimized C library for cryptographic operations on curve secp256k1.

Expand Down
Loading

0 comments on commit 90f54a4

Please sign in to comment.