Merge bitcoin-core/secp256k1#1756: ci: Fix image caching and apply other improvements
f163c35897ci: Set `DEBIAN_FRONTEND=noninteractive` (Hennadii Stepanov)70ae177ca0ci: Bump `docker/build-push-action` version (Hennadii Stepanov)b2a95a420fci: Drop `tags` input for `docker/build-push-action` (Hennadii Stepanov)122014edb3ci: Add `scope` parameter to `cache-{to,from}` options (Hennadii Stepanov) Pull request description: This PR fixes an issue where only the latest image cache was available. For other minor improvements, see the individual commit messages. ACKs for top commit: real-or-random: utACKf163c35897Tree-SHA512: 7178c447d32e5c06e42d33ed32c9088fc19ca6a67369f2a8f6672b0ec010a516d4bb3a70a1847eec76e034ec22d6df778f6d421a04ba603ae18526a6f4104e65
This commit is contained in:
20
.github/actions/run-in-docker-action/action.yml
vendored
20
.github/actions/run-in-docker-action/action.yml
vendored
@@ -4,9 +4,10 @@ inputs:
|
|||||||
dockerfile:
|
dockerfile:
|
||||||
description: 'A Dockerfile that defines an image'
|
description: 'A Dockerfile that defines an image'
|
||||||
required: true
|
required: true
|
||||||
tag:
|
scope:
|
||||||
description: 'A tag of an image'
|
description: 'A cached image scope'
|
||||||
required: true
|
required: false
|
||||||
|
default: ${{ runner.arch }}
|
||||||
command:
|
command:
|
||||||
description: 'A command to run in a container'
|
description: 'A command to run in a container'
|
||||||
required: false
|
required: false
|
||||||
@@ -16,25 +17,23 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- uses: docker/build-push-action@v5
|
- uses: docker/build-push-action@v6
|
||||||
id: main_builder
|
id: main_builder
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ${{ inputs.dockerfile }}
|
file: ${{ inputs.dockerfile }}
|
||||||
tags: ${{ inputs.tag }}
|
|
||||||
load: true
|
load: true
|
||||||
cache-from: type=gha
|
cache-from: type=gha,scope=${{ inputs.scope }}
|
||||||
|
|
||||||
- uses: docker/build-push-action@v5
|
- uses: docker/build-push-action@v6
|
||||||
id: retry_builder
|
id: retry_builder
|
||||||
if: steps.main_builder.outcome == 'failure'
|
if: steps.main_builder.outcome == 'failure'
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ${{ inputs.dockerfile }}
|
file: ${{ inputs.dockerfile }}
|
||||||
tags: ${{ inputs.tag }}
|
|
||||||
load: true
|
load: true
|
||||||
cache-from: type=gha
|
cache-from: type=gha,scope=${{ inputs.scope }}
|
||||||
|
|
||||||
- # Workaround for https://github.com/google/sanitizers/issues/1614 .
|
- # Workaround for https://github.com/google/sanitizers/issues/1614 .
|
||||||
# The underlying issue has been fixed in clang 18.1.3.
|
# The underlying issue has been fixed in clang 18.1.3.
|
||||||
@@ -47,7 +46,8 @@ runs:
|
|||||||
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "--env \(.) "') \
|
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "--env \(.) "') \
|
||||||
--volume ${{ github.workspace }}:${{ github.workspace }} \
|
--volume ${{ github.workspace }}:${{ github.workspace }} \
|
||||||
--workdir ${{ github.workspace }} \
|
--workdir ${{ github.workspace }} \
|
||||||
${{ inputs.tag }} bash -c "
|
$(docker images -q | head -n1) \
|
||||||
|
bash -c "
|
||||||
git config --global --add safe.directory ${{ github.workspace }}
|
git config --global --add safe.directory ${{ github.workspace }}
|
||||||
${{ inputs.command }}
|
${{ inputs.command }}
|
||||||
"
|
"
|
||||||
|
|||||||
37
.github/workflows/ci.yml
vendored
37
.github/workflows/ci.yml
vendored
@@ -67,12 +67,11 @@ jobs:
|
|||||||
network=host
|
network=host
|
||||||
|
|
||||||
- name: Build container
|
- name: Build container
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
file: ./ci/linux-debian.Dockerfile
|
file: ./ci/linux-debian.Dockerfile
|
||||||
tags: ${{ matrix.arch }}-debian-image
|
cache-from: type=gha,scope=${{ runner.arch }}
|
||||||
cache-from: type=gha
|
cache-to: type=gha,scope=${{ runner.arch }},mode=min
|
||||||
cache-to: type=gha,mode=min
|
|
||||||
|
|
||||||
x86_64-debian:
|
x86_64-debian:
|
||||||
name: "x86_64: Linux (Debian stable)"
|
name: "x86_64: Linux (Debian stable)"
|
||||||
@@ -116,7 +115,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -152,7 +150,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -184,7 +181,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -225,7 +221,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -265,7 +260,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: arm64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -297,7 +291,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -313,28 +306,22 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- docker_arch: x64
|
- runner: ubuntu-latest
|
||||||
runner: ubuntu-latest
|
|
||||||
binary_arch: x64
|
binary_arch: x64
|
||||||
env_vars: { CC: 'clang', ASM: 'auto' }
|
env_vars: { CC: 'clang', ASM: 'auto' }
|
||||||
- docker_arch: x64
|
- runner: ubuntu-latest
|
||||||
runner: ubuntu-latest
|
|
||||||
binary_arch: i686
|
binary_arch: i686
|
||||||
env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'auto' }
|
env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'auto' }
|
||||||
- docker_arch: arm64
|
- runner: ubuntu-24.04-arm
|
||||||
runner: ubuntu-24.04-arm
|
|
||||||
binary_arch: arm64
|
binary_arch: arm64
|
||||||
env_vars: { CC: 'clang', ASM: 'auto' }
|
env_vars: { CC: 'clang', ASM: 'auto' }
|
||||||
- docker_arch: x64
|
- runner: ubuntu-latest
|
||||||
runner: ubuntu-latest
|
|
||||||
binary_arch: x64
|
binary_arch: x64
|
||||||
env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
|
env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
|
||||||
- docker_arch: x64
|
- runner: ubuntu-latest
|
||||||
runner: ubuntu-latest
|
|
||||||
binary_arch: i686
|
binary_arch: i686
|
||||||
env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
|
env_vars: { CC: 'i686-linux-gnu-gcc', HOST: 'i686-linux-gnu', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
|
||||||
- docker_arch: arm64
|
- runner: ubuntu-24.04-arm
|
||||||
runner: ubuntu-24.04-arm
|
|
||||||
binary_arch: arm64
|
binary_arch: arm64
|
||||||
env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
|
env_vars: { CC: 'clang', ASM: 'no', ECMULTGENKB: 2, ECMULTWINDOW: 2 }
|
||||||
|
|
||||||
@@ -360,7 +347,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: ${{ matrix.docker_arch }}-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -404,7 +390,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -455,7 +440,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -498,7 +482,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -714,7 +697,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
|
|
||||||
- name: Print logs
|
- name: Print logs
|
||||||
uses: ./.github/actions/print-logs
|
uses: ./.github/actions/print-logs
|
||||||
@@ -733,7 +715,6 @@ jobs:
|
|||||||
uses: ./.github/actions/run-in-docker-action
|
uses: ./.github/actions/run-in-docker-action
|
||||||
with:
|
with:
|
||||||
dockerfile: ./ci/linux-debian.Dockerfile
|
dockerfile: ./ci/linux-debian.Dockerfile
|
||||||
tag: x64-debian-image
|
|
||||||
command: |
|
command: |
|
||||||
g++ -Werror include/*.h
|
g++ -Werror include/*.h
|
||||||
clang -Werror -x c++-header include/*.h
|
clang -Werror -x c++-header include/*.h
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ RUN dpkg --add-architecture i386 && \
|
|||||||
|
|
||||||
# dpkg-dev: to make pkg-config work in cross-builds
|
# dpkg-dev: to make pkg-config work in cross-builds
|
||||||
# llvm: for llvm-symbolizer, which is used by clang's UBSan for symbolized stack traces
|
# llvm: for llvm-symbolizer, which is used by clang's UBSan for symbolized stack traces
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
||||||
git ca-certificates \
|
git ca-certificates \
|
||||||
make automake libtool pkg-config dpkg-dev valgrind qemu-user \
|
make automake libtool pkg-config dpkg-dev valgrind qemu-user \
|
||||||
gcc clang llvm libclang-rt-dev libc6-dbg \
|
gcc clang llvm libclang-rt-dev libc6-dbg \
|
||||||
@@ -34,14 +34,15 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
|
|||||||
gcc-mingw-w64-i686-win32 wine32 \
|
gcc-mingw-w64-i686-win32 wine32 \
|
||||||
python3-full && \
|
python3-full && \
|
||||||
if ! ( dpkg --print-architecture | grep --quiet "arm64" ) ; then \
|
if ! ( dpkg --print-architecture | grep --quiet "arm64" ) ; then \
|
||||||
apt-get install --no-install-recommends -y \
|
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
||||||
gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 ;\
|
gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 ;\
|
||||||
fi && \
|
fi && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Build and install gcc snapshot
|
# Build and install gcc snapshot
|
||||||
ARG GCC_SNAPSHOT_MAJOR=16
|
ARG GCC_SNAPSHOT_MAJOR=16
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y wget libgmp-dev libmpfr-dev libmpc-dev flex && \
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
||||||
|
wget libgmp-dev libmpfr-dev libmpc-dev flex && \
|
||||||
mkdir gcc && cd gcc && \
|
mkdir gcc && cd gcc && \
|
||||||
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}" && \
|
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}" && \
|
||||||
wget "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}/sha512.sum" && \
|
wget "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}/sha512.sum" && \
|
||||||
@@ -62,7 +63,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y wget libgmp-dev
|
|||||||
# Install clang snapshot, see https://apt.llvm.org/
|
# Install clang snapshot, see https://apt.llvm.org/
|
||||||
RUN \
|
RUN \
|
||||||
# Setup GPG keys of LLVM repository
|
# Setup GPG keys of LLVM repository
|
||||||
apt-get update && apt-get install --no-install-recommends -y wget && \
|
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y wget && \
|
||||||
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
|
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \
|
||||||
# Add repository for this Debian release
|
# Add repository for this Debian release
|
||||||
. /etc/os-release && echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME} main" >> /etc/apt/sources.list && \
|
. /etc/os-release && echo "deb http://apt.llvm.org/${VERSION_CODENAME} llvm-toolchain-${VERSION_CODENAME} main" >> /etc/apt/sources.list && \
|
||||||
@@ -70,7 +71,7 @@ RUN \
|
|||||||
# Determine the version number of the LLVM development branch
|
# Determine the version number of the LLVM development branch
|
||||||
LLVM_VERSION=$(apt-cache search --names-only '^clang-[0-9]+$' | sort -V | tail -1 | cut -f1 -d" " | cut -f2 -d"-" ) && \
|
LLVM_VERSION=$(apt-cache search --names-only '^clang-[0-9]+$' | sort -V | tail -1 | cut -f1 -d" " | cut -f2 -d"-" ) && \
|
||||||
# Install
|
# Install
|
||||||
apt-get install --no-install-recommends -y "clang-${LLVM_VERSION}" && \
|
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y "clang-${LLVM_VERSION}" && \
|
||||||
# Create symlink
|
# Create symlink
|
||||||
ln -s "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang-snapshot && \
|
ln -s "/usr/bin/clang-${LLVM_VERSION}" /usr/bin/clang-snapshot && \
|
||||||
# Clean up
|
# Clean up
|
||||||
|
|||||||
Reference in New Issue
Block a user