Skip to content

Commit 4b0569f

Browse files
real-or-randomPiRK
authored andcommitted
[secp256k1] ci, gha: Add "x86_64: Linux (Debian stable)" GitHub Actions job
Summary: And also test gcc and clang snapshots. ------ [[bitcoin-core/secp256k1#1313 | secp256k1#1313]] > ci: Install development snapshots of gcc and clang bitcoin-core/secp256k1@1deecaa > ci: Add x86_64 Linux tasks for gcc and clang snapshots bitcoin-core/secp256k1@609093b ------ [[bitcoin-core/secp256k1#1396 | secp256k1#1396]] > ci: Remove GCC build files and sage to reduce size of Docker image > ci, gha: Add "x86_64: Linux (Debian stable)" GitHub Actions job > ci: Remove "x86_64: Linux (Debian stable)" task from Cirrus CI > ci, gha: Add `retry_builder` Docker image builder > > This change is aimed at significantly reducing the frequency of failures > caused by intermittent network timeouts. > ci, gha: Drop `driver-opts.network` input for `setup-buildx-action` ------ [[bitcoin-core/secp256k1#1719 | secp256k1#1719]] (partial) > ci: Use YAML anchor and aliases for repeated "Checkout" steps bitcoin-core/secp256k1@574c2f3 > ci: Use YAML anchor and aliases for repeated "CI script" steps bitcoin-core/secp256k1@1decc49 ------ Also initialize `ecount` in schnorrsig/test_impl.h to avoid a `-Wuninitialized-const-pointer` error with clang-snapshot. This will be done by core in bitcoin-core/secp256k1@b198061 This is a backport of secp256k#1313, [[bitcoin-core/secp256k1#1396 | secp256k1#1396]] and a partial backport of [[bitcoin-core/secp256k1#1719 | secp256k1#1719]] Test Plan: push to github, check github actions run successfully Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D19519
1 parent 67172d1 commit 4b0569f

5 files changed

Lines changed: 111 additions & 56 deletions

File tree

src/secp256k1/.cirrus.yml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,7 @@ linux_container_snippet: &LINUX_CONTAINER
4545
# Gives us more CPUs for free if they're available.
4646
greedy: true
4747
# More than enough for our scripts.
48-
memory: 1G
49-
50-
task:
51-
timeout_in: 120m
52-
name: "x86_64: Linux (Debian stable)"
53-
<< : *LINUX_CONTAINER
54-
matrix:
55-
- env: {WIDEMUL: int64, RECOVERY: yes}
56-
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
57-
- env: {WIDEMUL: int128}
58-
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
59-
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
60-
- env: {WIDEMUL: int128, ASM: x86_64}
61-
- env: { RECOVERY: yes, EXPERIMENTAL: yes, MULTISET: yes, SCHNORRSIG: yes}
62-
- env: {AUTOTOOLS_TARGET: distcheck, CMAKE_TARGET: install, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
63-
- env: {AUTOTOOLS_EXTRA_FLAGS: CPPFLAGS=-DDETERMINISTIC, CMAKE_EXTRA_FLAGS: -DCMAKE_C_FLAGS=-DDETERMINISTIC}
64-
- env: {AUTOTOOLS_EXTRA_FLAGS: CFLAGS=-O0, CMAKE_EXTRA_FLAGS: -DCMAKE_BUILD_TYPE=Debug, CTIMETEST: no}
65-
- env: {SCHNORR: no}
66-
- env: { ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
67-
- env: { ECMULTGENPRECISION: 8, ECMULTWINDOW: 4 }
68-
matrix:
69-
- env:
70-
CC: gcc
71-
- env:
72-
CC: clang
73-
test_script:
74-
- ./ci/build_autotools.sh
75-
- ./ci/build_cmake.sh
76-
<< : *CAT_LOGS
48+
memory: 2G
7749

7850
task:
7951
name: "i686: Linux (Debian stable)"

src/secp256k1/.github/actions/run-in-docker-action/action.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ runs:
1414
using: "composite"
1515
steps:
1616
- uses: docker/setup-buildx-action@v2
17+
18+
- uses: docker/build-push-action@v4
19+
id: main_builder
20+
continue-on-error: true
1721
with:
18-
# See: https://github.com/moby/buildkit/issues/3969.
19-
driver-opts: |
20-
network=host
22+
context: .
23+
file: ${{ inputs.dockerfile }}
24+
tags: ${{ inputs.tag }}
25+
load: true
26+
cache-from: type=gha
2127

2228
- uses: docker/build-push-action@v4
29+
id: retry_builder
30+
if: steps.main_builder.outcome == 'failure'
2331
with:
2432
context: .
2533
file: ${{ inputs.dockerfile }}

src/secp256k1/.github/workflows/ci.yml

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,58 @@ jobs:
5858
cache-from: type=gha
5959
cache-to: type=gha,mode=min
6060

61+
linux_debian:
62+
name: "x86_64: Linux (Debian stable)"
63+
runs-on: ubuntu-latest
64+
needs: docker_cache
65+
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
configuration:
70+
- env_vars: {WIDEMUL: 'int64', RECOVERY: 'yes'}
71+
- env_vars: {WIDEMUL: 'int64', ECDH: 'yes', EXPERIMENTAL: 'yes', MULTISET: 'yes', SCHNORRSIG: 'yes'}
72+
- env_vars: {WIDEMUL: 'int128'}
73+
- env_vars: {WIDEMUL: 'int128', RECOVERY: 'yes', EXPERIMENTAL: 'yes', SCHNORRSIG: 'yes'}
74+
- env_vars: {WIDEMUL: 'int128', ECDH: 'yes', EXPERIMENTAL: 'yes', MULTISET: 'yes', SCHNORRSIG: 'yes'}
75+
- env_vars: {WIDEMUL: 'int128', ASM: 'x86_64'}
76+
- env_vars: { RECOVERY: 'yes', EXPERIMENTAL: 'yes', MULTISET: 'yes', SCHNORRSIG: 'yes'}
77+
- env_vars: {AUTOTOOLS_TARGET: 'distcheck', CMAKE_TARGET: 'install', WITH_VALGRIND: 'no', CTIMETEST: 'no', BENCH: 'no'}
78+
- env_vars: {AUTOTOOLS_EXTRA_FLAGS: 'CPPFLAGS=-DDETERMINISTIC', CMAKE_EXTRA_FLAGS: '-DCMAKE_C_FLAGS=-DDETERMINISTIC'}
79+
- env_vars: {AUTOTOOLS_EXTRA_FLAGS: 'CFLAGS=-O0', CMAKE_EXTRA_FLAGS: '-DCMAKE_BUILD_TYPE=Debug', CTIMETEST: 'no'}
80+
- env_vars: {SCHNORR: 'no'}
81+
- env_vars: { ECMULTGENPRECISION: 2, ECMULTWINDOW: 2 }
82+
- env_vars: { ECMULTGENPRECISION: 8, ECMULTWINDOW: 4 }
83+
cc:
84+
- 'gcc'
85+
- 'clang'
86+
- 'gcc-snapshot'
87+
- 'clang-snapshot'
88+
89+
env:
90+
CC: ${{ matrix.cc }}
91+
92+
steps:
93+
- &CHECKOUT
94+
name: Checkout
95+
uses: actions/checkout@v5
96+
97+
- &CI_SCRIPT_IN_DOCKER
98+
name: CI script
99+
env: ${{ matrix.configuration.env_vars }}
100+
uses: ./.github/actions/run-in-docker-action
101+
with:
102+
dockerfile: ./ci/linux-debian.Dockerfile
103+
tag: linux-debian-image
104+
command: >
105+
git config --global --add safe.directory ${{ github.workspace }} &&
106+
./ci/build_autotools.sh && ./ci/build_cmake.sh
107+
108+
- &PRINT_ENV
109+
name: CI env
110+
run: env
111+
if: ${{ always() }}
112+
61113
mingw_debian:
62114
name: ${{ matrix.configuration.job_name }}
63115
runs-on: ubuntu-latest
@@ -85,22 +137,9 @@ jobs:
85137
HOST: 'i686-w64-mingw32'
86138

87139
steps:
88-
- name: Checkout
89-
uses: actions/checkout@v3
90-
91-
- name: CI script
92-
env: ${{ matrix.configuration.env_vars }}
93-
uses: ./.github/actions/run-in-docker-action
94-
with:
95-
dockerfile: ./ci/linux-debian.Dockerfile
96-
tag: linux-debian-image
97-
command: >
98-
git config --global --add safe.directory ${{ github.workspace }} &&
99-
./ci/build_autotools.sh && ./ci/build_cmake.sh
100-
101-
- name: CI env
102-
run: env
103-
if: ${{ always() }}
140+
- *CHECKOUT
141+
- *CI_SCRIPT_IN_DOCKER
142+
- *PRINT_ENV
104143

105144
macos-native:
106145
name: "x86_64: macOS Sequoia"
@@ -127,8 +166,7 @@ jobs:
127166
# Fixme: the following task fails with error "System.IO.IOException: No space left on device" even if we run only the autotools job
128167
# - { AUTOTOOLS_TARGET: 'distcheck', CMAKE_TARGET: 'install' }
129168
steps:
130-
- name: Checkout
131-
uses: actions/checkout@v5
169+
- *CHECKOUT
132170

133171
- name: Install Homebrew packages
134172
env:
@@ -146,9 +184,7 @@ jobs:
146184
env: ${{ matrix.env_vars }}
147185
run: ./ci/build_cmake.sh
148186

149-
- name: CI env
150-
run: env
151-
if: ${{ always() }}
187+
- *PRINT_ENV
152188

153189
sage:
154190
name: "SageMath prover"

src/secp256k1/ci/linux-debian.Dockerfile

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM debian:bookworm
1+
FROM debian:bookworm-slim
2+
3+
SHELL ["/bin/bash", "-c"]
24

35
RUN dpkg --add-architecture i386 && \
46
dpkg --add-architecture s390x && \
@@ -8,7 +10,7 @@ RUN dpkg --add-architecture i386 && \
810
# dkpg-dev: to make pkg-config work in cross-builds
911
# llvm: for llvm-symbolizer, which is used by clang's UBSan for symbolized stack traces
1012
RUN apt-get update && apt-get install --no-install-recommends --no-upgrade -y \
11-
git ca-certificates \
13+
git ca-certificates wget\
1214
automake cmake default-jdk dpkg-dev libssl-dev libtool make ninja-build pkg-config python3 qemu-user valgrind \
1315
gcc clang llvm libclang-rt-dev libc6-dbg \
1416
g++ \
@@ -19,5 +21,42 @@ RUN apt-get update && apt-get install --no-install-recommends --no-upgrade -y \
1921
gcc-mingw-w64-x86-64-win32 wine64 wine \
2022
gcc-mingw-w64-i686-win32 wine32
2123

24+
WORKDIR /root
25+
26+
# Build and install gcc snapshot
27+
ARG GCC_SNAPSHOT_MAJOR=14
28+
RUN mkdir gcc && cd gcc && \
29+
wget --progress=dot:giga --https-only --recursive --accept '*.tar.xz' --level 1 --no-directories "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}" && \
30+
wget "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}/sha512.sum" && \
31+
sha512sum --check --ignore-missing sha512.sum && \
32+
# We should have downloaded exactly one tar.xz file
33+
ls && \
34+
[[ $(ls *.tar.xz | wc -l) -eq "1" ]] && \
35+
tar xf *.tar.xz && \
36+
mkdir gcc-build && cd gcc-build && \
37+
apt-get update && apt-get install --no-install-recommends -y libgmp-dev libmpfr-dev libmpc-dev flex && \
38+
../*/configure --prefix=/opt/gcc-snapshot --enable-languages=c --disable-bootstrap --disable-multilib --without-isl && \
39+
make -j $(nproc) && \
40+
make install && \
41+
apt-get autoremove -y libgmp-dev libmpfr-dev libmpc-dev flex && \
42+
apt-get clean && \
43+
cd ../.. && rm -rf gcc && \
44+
ln -s /opt/gcc-snapshot/bin/gcc /usr/bin/gcc-snapshot
45+
46+
# Install clang snapshot
47+
RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
48+
# Add repository for this Debian release
49+
. /etc/os-release && echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME} main" >> /etc/apt/sources.list && \
50+
# Install clang snapshot
51+
apt-get update && apt-get install --no-install-recommends -y clang && \
52+
# Remove just the "clang" symlink again
53+
apt-get remove -y clang && \
54+
# We should have exactly two clang versions now
55+
ls /usr/bin/clang* && \
56+
[[ $(ls /usr/bin/clang-?? | sort | wc -l) -eq "2" ]] && \
57+
# Create symlinks for them
58+
ln -s $(ls /usr/bin/clang-?? | sort | tail -1) /usr/bin/clang-snapshot && \
59+
ln -s $(ls /usr/bin/clang-?? | sort | head -1) /usr/bin/clang
60+
2261
# Run a dummy command in wine to make it set up configuration
2362
RUN wine64-stable xcopy || true

src/secp256k1/src/modules/schnorrsig/tests_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void test_schnorrsig_api(void) {
133133
secp256k1_context *vrfy = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY);
134134
secp256k1_context *both = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY);
135135
secp256k1_context *sttc = secp256k1_context_clone(secp256k1_context_no_precomp);
136-
int ecount;
136+
int ecount = 0;
137137

138138
secp256k1_context_set_error_callback(none, counting_illegal_callback_fn, &ecount);
139139
secp256k1_context_set_error_callback(sign, counting_illegal_callback_fn, &ecount);

0 commit comments

Comments
 (0)