Skip to content

ci: DRY workflow using anchors #1719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 60 additions & 137 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,20 @@ jobs:
CC: ${{ matrix.cc }}

steps:
- name: Checkout
- &checkout
name: Checkout
uses: actions/checkout@v4

- name: CI script
- &x64_ci_script
name: CI script
env: ${{ matrix.configuration.env_vars }}
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
- &print-logs
name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}

Expand All @@ -130,6 +133,8 @@ jobs:
strategy:
fail-fast: false
matrix:
configuration:
- env_vars: {}
Comment on lines +136 to +137
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an empty matrix configuration with just 'env_vars: {}' appears to serve no functional purpose for the i686_debian job. This adds unnecessary complexity without providing the matrix benefits that other jobs use.

Suggested change
configuration:
- env_vars: {}

Copilot uses AI. Check for mistakes.

cc:
- 'i686-linux-gnu-gcc'
- 'clang --target=i686-pc-linux-gnu -isystem /usr/i686-linux-gnu/include'
Expand All @@ -145,24 +150,20 @@ jobs:
CC: ${{ matrix.cc }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}
- *checkout
- *x64_ci_script
- *print-logs

s390x_debian:
name: "s390x (big-endian): Linux (Debian stable, QEMU)"
runs-on: ubuntu-latest
needs: docker_cache

strategy:
matrix:
configuration:
- env_vars: {}

Comment on lines +162 to +166
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an empty matrix configuration with just 'env_vars: {}' appears to serve no functional purpose for the s390x_debian job. This adds unnecessary complexity without providing the matrix benefits that other jobs use.

Suggested change
strategy:
matrix:
configuration:
- env_vars: {}

Copilot uses AI. Check for mistakes.

env:
WRAPPER_CMD: 'qemu-s390x'
SECP256K1_TEST_ITERS: 16
Expand All @@ -177,19 +178,9 @@ jobs:
CTIMETESTS: 'no'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}

- *checkout
- *x64_ci_script
- *print-logs

arm32_debian:
name: "ARM32: Linux (Debian stable, QEMU)"
Expand Down Expand Up @@ -217,19 +208,9 @@ jobs:
CTIMETESTS: 'no'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
env: ${{ matrix.configuration.env_vars }}
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}
- *checkout
- *x64_ci_script
- *print-logs

arm64-debian:
name: "arm64: Linux (Debian stable)"
Expand Down Expand Up @@ -258,24 +239,26 @@ jobs:
- 'clang-snapshot'

steps:
- name: Checkout
uses: actions/checkout@v4
- *checkout

- name: CI script
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: arm64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}
- *print-logs

ppc64le_debian:
name: "ppc64le: Linux (Debian stable, QEMU)"
runs-on: ubuntu-latest
needs: docker_cache

strategy:
matrix:
configuration:
- env_vars: {}

Comment on lines +257 to +261
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an empty matrix configuration with just 'env_vars: {}' appears to serve no functional purpose for the ppc64le_debian job. This adds unnecessary complexity without providing the matrix benefits that other jobs use.

Suggested change
strategy:
matrix:
configuration:
- env_vars: {}

Copilot uses AI. Check for mistakes.

env:
WRAPPER_CMD: 'qemu-ppc64le'
SECP256K1_TEST_ITERS: 16
Expand All @@ -290,19 +273,9 @@ jobs:
CTIMETESTS: 'no'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}

- *checkout
- *x64_ci_script
- *print-logs

valgrind_debian:
name: "Valgrind ${{ matrix.binary_arch }} (memcheck)"
Expand Down Expand Up @@ -352,8 +325,7 @@ jobs:
SECP256K1_TEST_ITERS: 2

steps:
- name: Checkout
uses: actions/checkout@v4
- *checkout

- name: CI script
env: ${{ matrix.env_vars }}
Expand All @@ -362,9 +334,7 @@ jobs:
dockerfile: ./ci/linux-debian.Dockerfile
tag: ${{ matrix.docker_arch }}-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}
- *print-logs

sanitizers_debian:
name: "UBSan, ASan, LSan"
Expand Down Expand Up @@ -396,19 +366,9 @@ jobs:
SYMBOL_CHECK: 'no'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
env: ${{ matrix.configuration.env_vars }}
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}
- *checkout
- *x64_ci_script
- *print-logs

msan_debian:
name: "MSan"
Expand Down Expand Up @@ -447,20 +407,9 @@ jobs:
SYMBOL_CHECK: 'no'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
env: ${{ matrix.configuration.env_vars }}
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}

- *checkout
- *x64_ci_script
- *print-logs

mingw_debian:
name: ${{ matrix.configuration.job_name }}
Expand Down Expand Up @@ -490,19 +439,9 @@ jobs:
HOST: 'i686-w64-mingw32'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
env: ${{ matrix.configuration.env_vars }}
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}
- *checkout
- *x64_ci_script
- *print-logs

x86_64-macos-native:
name: "x86_64: macOS Ventura, Valgrind"
Expand Down Expand Up @@ -531,8 +470,7 @@ jobs:
- BUILD: 'distcheck'

steps:
- name: Checkout
uses: actions/checkout@v4
- *checkout

- name: Install Homebrew packages
run: |
Expand All @@ -552,9 +490,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"
Expand Down Expand Up @@ -583,8 +519,7 @@ jobs:
- BUILD: 'distcheck'

steps:
- name: Checkout
uses: actions/checkout@v4
- *checkout

- name: Install Homebrew packages
run: |
Expand All @@ -605,10 +540,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 }}
Expand All @@ -635,8 +567,7 @@ jobs:
cmake_options: '-T ClangCL'

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 }}
Expand Down Expand Up @@ -671,8 +602,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
Expand All @@ -686,6 +616,11 @@ jobs:
runs-on: ubuntu-latest
needs: docker_cache

strategy:
matrix:
configuration:
- env_vars: {}

Comment on lines +619 to +623
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an empty matrix configuration with just 'env_vars: {}' appears to serve no functional purpose for the cpp_gcc_debian job. This adds unnecessary complexity without providing the matrix benefits that other jobs use.

Suggested change
strategy:
matrix:
configuration:
- env_vars: {}

Copilot uses AI. Check for mistakes.

env:
CC: 'g++'
CFLAGS: '-fpermissive -g'
Expand All @@ -699,27 +634,17 @@ jobs:
ELLSWIFT: 'yes'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI script
uses: ./.github/actions/run-in-docker-action
with:
dockerfile: ./ci/linux-debian.Dockerfile
tag: x64-debian-image

- name: Print logs
uses: ./.github/actions/print-logs
if: ${{ !cancelled() }}
- *checkout
- *x64_ci_script
- *print-logs

cxx_headers_debian:
name: "C++ (public headers)"
runs-on: ubuntu-latest
needs: docker_cache

steps:
- name: Checkout
uses: actions/checkout@v4
- *checkout

- name: CI script
uses: ./.github/actions/run-in-docker-action
Expand All @@ -738,8 +663,7 @@ jobs:
options: --user root

steps:
- name: Checkout
uses: actions/checkout@v4
- *checkout

- name: CI script
run: |
Expand All @@ -750,8 +674,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- *checkout

- run: ./autogen.sh && ./configure --enable-dev-mode && make distcheck

Expand Down