From 574c2f3080eeb65995a1c1a430ed7f84803afd26 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 14 Oct 2025 11:47:23 +0100 Subject: [PATCH 1/6] ci: Use YAML anchor and aliases for repeated "Checkout" steps --- .github/workflows/ci.yml | 54 ++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f22ef2a3..4e0a028c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,7 +107,8 @@ jobs: CC: ${{ matrix.cc }} steps: - - name: Checkout + - &CHECKOUT + name: Checkout uses: actions/checkout@v4 - name: CI script @@ -143,8 +144,7 @@ jobs: CC: ${{ matrix.cc }} steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script uses: ./.github/actions/run-in-docker-action @@ -174,8 +174,7 @@ jobs: CTIMETESTS: 'no' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script uses: ./.github/actions/run-in-docker-action @@ -213,8 +212,7 @@ jobs: CTIMETESTS: 'no' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script env: ${{ matrix.configuration.env_vars }} @@ -253,8 +251,7 @@ jobs: - 'clang-snapshot' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script uses: ./.github/actions/run-in-docker-action @@ -284,8 +281,7 @@ jobs: CTIMETESTS: 'no' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script uses: ./.github/actions/run-in-docker-action @@ -339,8 +335,7 @@ jobs: SECP256K1_TEST_ITERS: 2 steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script env: ${{ matrix.env_vars }} @@ -382,8 +377,7 @@ jobs: SYMBOL_CHECK: 'no' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script env: ${{ matrix.configuration.env_vars }} @@ -432,8 +426,7 @@ jobs: SYMBOL_CHECK: 'no' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script env: ${{ matrix.configuration.env_vars }} @@ -474,8 +467,7 @@ jobs: HOST: 'i686-w64-mingw32' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script env: ${{ matrix.configuration.env_vars }} @@ -514,8 +506,7 @@ jobs: - BUILD: 'distcheck' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: Install Homebrew packages run: | @@ -566,8 +557,7 @@ jobs: - BUILD: 'distcheck' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: Install Homebrew packages run: | @@ -626,8 +616,7 @@ jobs: cpp_flags: '/DSECP256K1_MSVC_MULH_TEST_OVERRIDE' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: Generate buildsystem run: cmake -E env CFLAGS="/WX ${{ matrix.configuration.cpp_flags }}" cmake -B build -DSECP256K1_ENABLE_MODULE_RECOVERY=ON -DSECP256K1_BUILD_EXAMPLES=ON ${{ matrix.configuration.cmake_options }} @@ -662,8 +651,7 @@ jobs: runs-on: windows-2022 steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: Add cl.exe to PATH uses: ilammy/msvc-dev-cmd@v1 @@ -690,8 +678,7 @@ jobs: ELLSWIFT: 'yes' steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script uses: ./.github/actions/run-in-docker-action @@ -708,8 +695,7 @@ jobs: needs: docker_cache steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script uses: ./.github/actions/run-in-docker-action @@ -727,8 +713,7 @@ jobs: options: --user root steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - name: CI script run: | @@ -739,8 +724,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - *CHECKOUT - run: ./autogen.sh && ./configure --enable-dev-mode && make distcheck From a889cd93dfe5558aaa0320e241555bb96483c92b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 14 Oct 2025 11:49:05 +0100 Subject: [PATCH 2/6] ci: Bump `actions/checkout` version See https://github.com/actions/checkout/releases. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e0a028c..6f7b51dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: steps: - &CHECKOUT name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: CI script env: ${{ matrix.configuration.env_vars }} From 4b644da199587cdf9554fb48c0da7643c3ce7f30 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 14 Oct 2025 11:51:22 +0100 Subject: [PATCH 3/6] ci: Use YAML anchor and aliases for repeated "Print logs" steps --- .github/workflows/ci.yml | 55 ++++++++++------------------------------ 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f7b51dd..7195b7da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,7 +117,8 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs + - &PRINT_LOGS + name: Print logs uses: ./.github/actions/print-logs if: ${{ !cancelled() }} @@ -151,9 +152,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS s390x_debian: name: "s390x (big-endian): Linux (Debian stable, QEMU)" @@ -181,10 +180,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} - + - *PRINT_LOGS arm32_debian: name: "ARM32: Linux (Debian stable, QEMU)" @@ -220,9 +216,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS arm64-debian: name: "arm64: Linux (Debian stable)" @@ -258,9 +252,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS ppc64le_debian: name: "ppc64le: Linux (Debian stable, QEMU)" @@ -288,10 +280,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} - + - *PRINT_LOGS valgrind_debian: name: "Valgrind ${{ matrix.binary_arch }} (memcheck)" @@ -343,9 +332,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS sanitizers_debian: name: "UBSan, ASan, LSan" @@ -385,9 +372,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS msan_debian: name: "MSan" @@ -434,10 +419,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} - + - *PRINT_LOGS mingw_debian: name: ${{ matrix.configuration.job_name }} @@ -475,9 +457,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS x86_64-macos-native: name: "x86_64: macOS Ventura, Valgrind" @@ -526,9 +506,7 @@ jobs: python3 -m pip install lief python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS arm64-macos-native: name: "ARM64: macOS Sonoma" @@ -578,10 +556,7 @@ jobs: python3 -m pip install lief python3 ./tools/symbol-check.py .libs/libsecp256k1.dylib - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} - + - *PRINT_LOGS win64-native: name: ${{ matrix.configuration.job_name }} @@ -685,9 +660,7 @@ jobs: with: dockerfile: ./ci/linux-debian.Dockerfile - - name: Print logs - uses: ./.github/actions/print-logs - if: ${{ !cancelled() }} + - *PRINT_LOGS cxx_headers_debian: name: "C++ (public headers)" From dff1bc107d593b12e824cbc04b0d220f2ffeb967 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 14 Oct 2025 12:23:54 +0100 Subject: [PATCH 4/6] ci, refactor: Generalize use of `matrix.configuration.env_vars` --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7195b7da..07a574d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,6 +130,8 @@ jobs: strategy: fail-fast: false matrix: + configuration: + - env_vars: {} cc: - 'i686-linux-gnu-gcc' - 'clang --target=i686-pc-linux-gnu -isystem /usr/i686-linux-gnu/include' @@ -148,6 +150,7 @@ jobs: - *CHECKOUT - name: CI script + env: ${{ matrix.configuration.env_vars }} uses: ./.github/actions/run-in-docker-action with: dockerfile: ./ci/linux-debian.Dockerfile @@ -159,6 +162,11 @@ jobs: runs-on: ubuntu-latest needs: docker_cache + strategy: + matrix: + configuration: + - env_vars: {} + env: WRAPPER_CMD: 'qemu-s390x' SECP256K1_TEST_ITERS: 16 @@ -176,6 +184,7 @@ jobs: - *CHECKOUT - name: CI script + env: ${{ matrix.configuration.env_vars }} uses: ./.github/actions/run-in-docker-action with: dockerfile: ./ci/linux-debian.Dockerfile @@ -238,6 +247,8 @@ jobs: strategy: fail-fast: false matrix: + configuration: + - env_vars: {} cc: - 'gcc' - 'clang' @@ -248,6 +259,7 @@ jobs: - *CHECKOUT - name: CI script + env: ${{ matrix.configuration.env_vars }} uses: ./.github/actions/run-in-docker-action with: dockerfile: ./ci/linux-debian.Dockerfile @@ -259,6 +271,11 @@ jobs: runs-on: ubuntu-latest needs: docker_cache + strategy: + matrix: + configuration: + - env_vars: {} + env: WRAPPER_CMD: 'qemu-ppc64le' SECP256K1_TEST_ITERS: 16 @@ -276,6 +293,7 @@ jobs: - *CHECKOUT - name: CI script + env: ${{ matrix.configuration.env_vars }} uses: ./.github/actions/run-in-docker-action with: dockerfile: ./ci/linux-debian.Dockerfile @@ -283,14 +301,14 @@ jobs: - *PRINT_LOGS valgrind_debian: - name: "Valgrind ${{ matrix.binary_arch }} (memcheck)" - runs-on: ${{ matrix.runner }} + name: "Valgrind ${{ matrix.configuration.binary_arch }} (memcheck)" + runs-on: ${{ matrix.configuration.runner }} needs: docker_cache strategy: fail-fast: false matrix: - include: + configuration: - runner: ubuntu-latest binary_arch: x64 env_vars: { CC: 'clang', ASM: 'auto' } @@ -327,7 +345,7 @@ jobs: - *CHECKOUT - name: CI script - env: ${{ matrix.env_vars }} + env: ${{ matrix.configuration.env_vars }} uses: ./.github/actions/run-in-docker-action with: dockerfile: ./ci/linux-debian.Dockerfile @@ -640,6 +658,11 @@ jobs: runs-on: ubuntu-latest needs: docker_cache + strategy: + matrix: + configuration: + - env_vars: {} + env: CC: 'g++' CFLAGS: '-fpermissive -g' @@ -656,6 +679,7 @@ jobs: - *CHECKOUT - name: CI script + env: ${{ matrix.configuration.env_vars }} uses: ./.github/actions/run-in-docker-action with: dockerfile: ./ci/linux-debian.Dockerfile From 1decc49a1f08564064420468fc48b9aebd3989d3 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 14 Oct 2025 12:24:25 +0100 Subject: [PATCH 5/6] ci: Use YAML anchor and aliases for repeated "CI script" steps --- .github/workflows/ci.yml | 90 +++++++--------------------------------- 1 file changed, 15 insertions(+), 75 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07a574d0..83272941 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,7 +111,8 @@ jobs: name: Checkout uses: actions/checkout@v5 - - name: CI script + - &CI_SCRIPT_IN_DOCKER + name: CI script env: ${{ matrix.configuration.env_vars }} uses: ./.github/actions/run-in-docker-action with: @@ -148,13 +149,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS s390x_debian: @@ -182,13 +177,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS arm32_debian: @@ -218,13 +207,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS arm64-debian: @@ -257,13 +240,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS ppc64le_debian: @@ -291,13 +268,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS valgrind_debian: @@ -343,13 +314,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS sanitizers_debian: @@ -383,13 +348,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS msan_debian: @@ -430,13 +389,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS mingw_debian: @@ -468,13 +421,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS x86_64-macos-native: @@ -514,7 +461,8 @@ jobs: - name: Install and cache Valgrind uses: ./.github/actions/install-homebrew-valgrind - - name: CI script + - &CI_SCRIPT_ON_HOST + name: CI script env: ${{ matrix.env_vars }} run: ./ci/ci.sh @@ -560,9 +508,7 @@ jobs: brew install --quiet automake libtool gcc ln -s $(brew --prefix gcc)/bin/gcc-?? /usr/local/bin/gcc - - name: CI script - env: ${{ matrix.env_vars }} - run: ./ci/ci.sh + - *CI_SCRIPT_ON_HOST - name: Symbol check env: @@ -677,13 +623,7 @@ jobs: steps: - *CHECKOUT - - - name: CI script - env: ${{ matrix.configuration.env_vars }} - uses: ./.github/actions/run-in-docker-action - with: - dockerfile: ./ci/linux-debian.Dockerfile - + - *CI_SCRIPT_IN_DOCKER - *PRINT_LOGS cxx_headers_debian: From 15d014804e5927b0f9dd8ed4fdc0be2a45f74e24 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 14 Oct 2025 12:24:36 +0100 Subject: [PATCH 6/6] ci: Drop default for `inputs.command` in `run-in-docker-action` This change decreases coupling. --- .github/actions/run-in-docker-action/action.yml | 3 +-- .github/workflows/ci.yml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-in-docker-action/action.yml b/.github/actions/run-in-docker-action/action.yml index d3ab44b1..5d46ca1b 100644 --- a/.github/actions/run-in-docker-action/action.yml +++ b/.github/actions/run-in-docker-action/action.yml @@ -10,8 +10,7 @@ inputs: default: ${{ runner.arch }} command: description: 'A command to run in a container' - required: false - default: ./ci/ci.sh + required: true runs: using: "composite" steps: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83272941..8508224e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,6 +117,7 @@ jobs: uses: ./.github/actions/run-in-docker-action with: dockerfile: ./ci/linux-debian.Dockerfile + command: ./ci/ci.sh - &PRINT_LOGS name: Print logs