Skip to content
Draft
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Build container
on:
workflow_call:
inputs:
build-contexts:
description: "Paths to additional build contexts"
required: false
type: string
context:
description: "Path to use for build context"
required: true
Expand Down Expand Up @@ -56,6 +60,7 @@ jobs:
with:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
build-contexts: ${{ inputs.build-contexts }}
push: true
tags: |
ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.name }}:${{ hashFiles(inputs.file) }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
export HOST="${{ steps.setup.outputs.HOST }}"
if [ "${HOST}" = "x86_64-apple-darwin" ]; then
./contrib/containers/guix/scripts/setup-sdk
unset LIBRARY_PATH LD_LIBRARY_PATH
fi
env ${{ steps.setup.outputs.DEP_OPTS }} make -j$(nproc) -C depends

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ jobs:
BASE_OUTDIR="/output"
BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
if [ "${HOST}" = "x86_64-apple-darwin" ]; then
unset LIBRARY_PATH LD_LIBRARY_PATH
fi
./ci/dash/build_src.sh
ccache -X 9
ccache -c
Expand All @@ -108,6 +111,8 @@ jobs:
run: |
export BUILD_TARGET="${{ inputs.build-target }}"
export BUNDLE_KEY="build-${BUILD_TARGET}-$(git rev-parse --short=8 HEAD)"
export BASE_DIR="$(pwd)"
./ci/dash/build_patch.sh
./ci/dash/bundle-artifacts.sh create
echo "key=${BUNDLE_KEY}" >> "${GITHUB_OUTPUT}"

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
context: ./contrib/containers/ci
file: ./contrib/containers/ci/ci.Dockerfile
name: dashcore-ci-runner
build-contexts: |
docker_root=./contrib/containers/ci

container-slim:
name: Build slim container
Expand Down
68 changes: 68 additions & 0 deletions ci/dash/build_patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
# Copyright (c) 2025 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

export LC_ALL=C.UTF-8

set -eo pipefail

SH_NAME="$(basename "${0}")"

if [ -z "${BASE_DIR}" ]; then
echo "${SH_NAME}: BASE_DIR not defined, cannot continue!";
exit 1;
elif [ -z "${BUILD_TARGET}" ]; then
echo "${SH_NAME}: BUILD_TARGET not defined, cannot continue!";
exit 1;
elif [ ! "$(command -v uname)" ]; then
echo "${SH_NAME}: uname not found, cannot continue!";
exit 1;
elif [ ! "$(command -v patchelf)" ]; then
echo "${SH_NAME}: patchelf not found, cannot continue!";
exit 1;
elif [ ! -d "${BASE_DIR}/build-ci/dashcore-${BUILD_TARGET}/src" ]; then
echo "${SH_NAME}: cannot find directory for binaries to patch, cannot continue!";
exit 1;
fi

# uname -m | interpreter
# -------- | -----------------------------
# aarch64 | /lib/ld-linux-aarch64.so.1
# armhf | /lib/ld-linux-armhf.so.3
# i686 | /lib/ld-linux.so.2
# riscv64 | /lib/ld-linux-riscv64-lp64d.so.1
# x86_64 | /lib64/ld-linux-x86-64.so.2

INTERPRETER=""
case "${BUILD_TARGET}" in
"linux64_nowallet" | "linux64_sqlite")
INTERPRETER="/lib64/ld-linux-x86-64.so.2";
;;
*)
echo "${SH_NAME}: Nothing to do, exiting!";
exit 0;
;;
esac

BINARIES=(
"dashd"
"dash-cli"
"dash-gui"
"dash-node"
"dash-tx"
"dash-wallet"
"bench/bench_dash"
"qt/dash-qt"
"qt/test/test_dash-qt"
"test/test_dash"
"test/fuzz/fuzz"
)

for target in "${BINARIES[@]}"
do
target_path="${BASE_DIR}/build-ci/dashcore-${BUILD_TARGET}/src/${target}"
if [[ -f "${target_path}" ]]; then
patchelf --set-interpreter "${INTERPRETER}" "${target_path}";
fi
done
4 changes: 2 additions & 2 deletions ci/test/00_setup_env_native_nowallet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_native_nowallet
export HOST=x86_64-pc-linux-gnu
export PACKAGES="python3-zmq"
export DEP_OPTS="NO_WALLET=1 CC=gcc-14 CXX=g++-14"
export DEP_OPTS="NO_WALLET=1 CC=gcc-15 CXX=g++-15"
export GOAL="install"
export BITCOIN_CONFIG="--enable-reduce-exports --with-boost-process CC=gcc-14 CXX=g++-14"
export BITCOIN_CONFIG="--enable-reduce-exports --with-boost-process CC=gcc-15 CXX=g++-15"
4 changes: 2 additions & 2 deletions ci/test/00_setup_env_native_qt5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_native_qt5
export HOST=x86_64-pc-linux-gnu
export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev"
export DEP_OPTS=""
export DEP_OPTS="CC=gcc-11 CXX=g++-11"
export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_pruning,feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
export RUN_UNIT_TESTS_SEQUENTIAL="true"
export RUN_UNIT_TESTS="false"
export GOAL="install"
export DOWNLOAD_PREVIOUS_RELEASES="true"
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports LDFLAGS=-static-libstdc++ --with-boost-process"
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --enable-reduce-exports LDFLAGS=-static-libstdc++ --with-boost-process CC=gcc CXX=g++"
1 change: 1 addition & 0 deletions contrib/containers/ci/ci-slim.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ RUN set -ex; \
libsqlite3-dev \
libssl-dev \
make \
patchelf \
xz-utils \
zlib1g-dev \
zstd \
Expand Down
42 changes: 40 additions & 2 deletions contrib/containers/ci/ci.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ RUN set -ex; \
bsdmainutils \
ccache \
cmake \
g++-11 \
g++-14 \
g++-arm-linux-gnueabihf \
g++-mingw-w64-x86-64 \
gawk \
Expand Down Expand Up @@ -67,6 +65,46 @@ RUN set -ex; \
make install -j "$(( $(nproc) - 1 ))"; \
cd /opt && rm -rf /opt/iwyu;

# Install Nix to fetch versioned GCC releases
RUN set -ex; \
curl -fsSL https://install.determinate.systems/nix | sh -s -- install linux \
--determinate \
--extra-conf "sandbox = false" \
--no-confirm \
--init none
ENV PATH="/nix/var/nix/profiles/default/bin:${PATH}" \
NIX_CONF_DIR="/etc/nix"
COPY --from=docker_root ./nix.custom.conf /etc/nix/nix.custom.conf
COPY --from=docker_root ./default.nix /etc/nix/
RUN set -ex; \
nix-env -f /etc/nix/default.nix -i; \
nix-collect-garbage -d; \
nix-store --optimise;
RUN set -ex; \
chmod -R o+rX /nix/store /nix/var/nix/profiles/default; \
mkdir -p /usr/local/bin /usr/local/lib /usr/local/lib64; \
for bin in /nix/var/nix/profiles/default/bin/*; do \
if [ -f "$bin" ]; then \
ln -sf "$bin" "/usr/local/bin/$(basename "$bin")"; \
fi; \
done; \
for dir in /nix/var/nix/profiles/default/lib/*; do \
if [ -d "$dir" ]; then \
ln -sf "$dir" "/usr/local/lib/$(basename "$dir")"; \
fi; \
done; \
for dir in /nix/var/nix/profiles/default/lib64/*; do \
if [ -d "$dir" ]; then \
ln -sf "$dir" "/usr/local/lib64/$(basename "$dir")"; \
fi; \
done; \
ln -sf "/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)" "/usr/lib/multiarch"
# Nix-supplied compilers won't search for distro-installed libraries without explicit
# specification and we can't run binaries built with those compilers without specifying
# where their runtime dependencies are
ENV LD_LIBRARY_PATH="/usr/local/lib64/gcc-15:/usr/local/lib/gcc-15:/usr/local/lib64/gcc-11:/usr/local/lib/gcc-11:${LD_LIBRARY_PATH}"
ENV LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/multiarch:/usr/lib"

RUN \
mkdir -p /cache/ccache && \
mkdir /cache/depends && \
Expand Down
86 changes: 86 additions & 0 deletions contrib/containers/ci/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
let
pkgsLegacy = import (builtins.fetchTarball {
name = "nixos-23.11";
url = "https://github.com/NixOS/nixpkgs/archive/23.11.tar.gz";
sha256 = "sha256-MxCVrXY6v4QmfTwIysjjaX0XUhqBbxTWWB4HXtDYsdk=";
}) {};

pkgsUnstable = import (builtins.fetchTarball {
name = "nixos-unstable";
url = "https://github.com/NixOS/nixpkgs/archive/85a6c4a07faa12aaccd81b36ba9bfc2bec974fa1.tar.gz";
sha256 = "sha256-3YJkOBrFpmcusnh7i8GXXEyh7qZG/8F5z5+717550Hk=";
}) {};
in
pkgsUnstable.buildEnv {
name = "nixEnv";
ignoreCollisions = true;
paths = [
pkgsLegacy.gcc11
pkgsUnstable.gcc15
];

postBuild = ''
binaries=(
addr2line
ar
as
c++
c++filt
cc
cpp
dwp
elfedit
g++
gcc
gcc-ar
gcc-nm
gcc-ranlib
gccgo
gcov
gcov-dump
gcov-tool
gdc
gfortran
gprof
ld
ld.bfd
ld.gold
lto-dump
nm
objcopy
objdump
ranlib
readelf
size
strings
strip
)

target_triple="${pkgsUnstable.stdenv.targetPlatform.config}"
for binary in "''${binaries[@]}"; do
if [ -f "${pkgsLegacy.gcc11}/bin/$binary" ]; then
ln -sf "${pkgsLegacy.gcc11}/bin/$binary" "$out/bin/$binary-11"
ln -sf "${pkgsLegacy.gcc11}/bin/$binary" "$out/bin/$target_triple-$binary-11"
fi
if [ -f "${pkgsUnstable.gcc15}/bin/$binary" ]; then
ln -sf "${pkgsUnstable.gcc15}/bin/$binary" "$out/bin/$binary-15"
ln -sf "${pkgsUnstable.gcc15}/bin/$binary" "$out/bin/$target_triple-$binary-15"
fi
rm -f "$out/bin/$binary"
done

mkdir -p $out/lib $out/lib64
if [ -d "${pkgsLegacy.gcc11.cc.lib}/lib" ]; then
ln -sf "${pkgsLegacy.gcc11.cc.lib}/lib" "$out/lib/gcc-11"
fi
if [ -d "${pkgsLegacy.gcc11.cc.lib}/lib64" ]; then
ln -sf "${pkgsLegacy.gcc11.cc.lib}/lib64" "$out/lib64/gcc-11"
fi
if [ -d "${pkgsUnstable.gcc15.cc.lib}/lib" ]; then
ln -sf "${pkgsUnstable.gcc15.cc.lib}/lib" "$out/lib/gcc-15"
fi
if [ -d "${pkgsUnstable.gcc15.cc.lib}/lib64" ]; then
ln -sf "${pkgsUnstable.gcc15.cc.lib}/lib64" "$out/lib64/gcc-15"
fi
'';
}
15 changes: 15 additions & 0 deletions contrib/containers/ci/nix.custom.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
experimental-features = auto-allocate-uids flakes nix-command

# Space optimization
auto-optimise-store = true

# Builder settings for CI
auto-allocate-uids = true
cores = 0
max-jobs = auto

# Binary caches for faster downloads
accept-flake-config = true
substituters = https://cache.nixos.org https://nix-community.cachix.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
max-substitution-jobs = 0
1 change: 0 additions & 1 deletion contrib/containers/develop/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ RUN set -ex; \
openssh-client \
screen \
sudo \
zsh \
&& \
rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 2 additions & 0 deletions contrib/containers/develop/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ services:
build:
context: '..'
dockerfile: './develop/Dockerfile'
additional_contexts:
- docker_root=../ci
args:
USER_ID: 1000 # set this to $(id -u) of the host
GROUP_ID: 1000 # set this to $(id -g) of the host
Expand Down
Loading