Skip to content

Update ci.yml

Update ci.yml #291

Workflow file for this run

name: Continuous Integration
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- 'doc/**'
- 'contrib/**'
- '**/*.md'
jobs:
build:
name: ${{ matrix.name }}
env:
MAKEJOBS: "-j3"
CHECK_DOC: "0"
CCACHE_SIZE: "100M"
CCACHE_TEMPDIR: /tmp/.ccache-temp
CCACHE_COMPRESS: "1"
PYTHON_DEBUG: "1"
CACHE_NONCE: "1"
WINEDEBUG: fixme-all
WINEPREFIX: /tmp/wineprefix/
SDK_URL: https://depends.dogecoincore.org
strategy:
fail-fast: false
matrix:
name:
- aarch64-linux
- armhf-linux
- i686-linux
- i686-win
- x86_64-linux
- x86_64-macos
- x86_64-win
include:
- name: i686-linux
host: i686-pc-linux-gnu
container: ubuntu:20.04
packages: g++-multilib bc python3-zmq
run-bench: false
check-security: true
check-symbols: false
dep-opts: "NO_QT=1"
config-opts: "--enable-zmq --enable-glibc-back-compat LDFLAGS=-static-libstdc++ --disable-tests"
goal: install
- name: armhf-linux
host: arm-linux-gnueabihf
container: ubuntu:20.04
packages: g++-arm-linux-gnueabihf qemu-user-static qemu-user
run-bench: false
check-security: true
check-symbols: false
dep-opts: "NO_QT=1"
config-opts: "--enable-glibc-back-compat LDFLAGS=-static-libstdc++ --disable-tests"
goal: install
- name: aarch64-linux
host: aarch64-linux-gnu
container: ubuntu:20.04
packages: g++-aarch64-linux-gnu qemu-user-static qemu-user
run-bench: false
check-security: true
check-symbols: false
dep-opts: "NO_QT=1"
config-opts: "--enable-zmq --enable-glibc-back-compat LDFLAGS=-static-libstdc++ --disable-tests"
goal: install
- name: x86_64-linux
host: x86_64-unknown-linux-gnu
container: ubuntu:20.04
packages: python3 g++-multilib bc python3-zmq
run-bench: false
check-security: true
check-symbols: false
dep-opts: "NO_QT=1"
config-opts: "--enable-zmq --enable-glibc-back-compat LDFLAGS=-static-libstdc++ --disable-tests"
goal: install
- name: i686-win
host: i686-w64-mingw32
container: ubuntu:20.04
container-options: --privileged
packages: python3 nsis g++-mingw-w64-i686 wine32 bc wine-binfmt binfmt-support
preinstall: |
dpkg --add-architecture i386
postinstall: |
update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
update-binfmts --import /usr/share/binfmts/wine
update-binfmts --enable
update-binfmts --display
run-bench: false
check-security: true
check-symbols: false
dep-opts: ""
config-opts: "--with-gui=qt5 --disable-tests"
goal: install
- name: x86_64-win
host: x86_64-w64-mingw32
container: ubuntu:20.04
container-options: --privileged
packages: python3 nsis g++-mingw-w64-x86-64 wine64 bc wine-binfmt
postinstall: |
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
update-binfmts --import /usr/share/binfmts/wine
update-binfmts --enable
update-binfmts --display
run-bench: false
check-security: true
check-symbols: false
dep-opts: ""
config-opts: "--with-gui=qt5 --disable-tests"
goal: install
- name: x86_64-macos
host: x86_64-apple-darwin11
container: ubuntu:20.04
packages: cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools libtinfo5 xorriso
run-bench: false
check-security: true
check-symbols: false
dep-opts: ""
config-opts: "--with-gui=qt5 --disable-tests"
goal: deploy
sdk: 11.0
sdk-shasum: "c8a9ff16196be43c35b699dd293f0c0563f1239c99caa6b3d53882e556a209bd"
runs-on: ubuntu-22.04
container:
image: ${{ matrix.container }}
options: ${{ matrix.container-options == '' && '-e 1ARCH=1ARCH' || matrix.container-options }}
steps:
- name: Configure container
run: |
ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime
echo Etc/UTC > /etc/timezone
mkdir -p $WINEPREFIX
uname -a
- name: Pre install
if: ${{ matrix.preinstall }}
run: ${{ matrix.preinstall }}
- name: Install packages
run: |
apt-get update
apt-get install -y build-essential libtool autotools-dev automake \
pkg-config bsdmainutils curl ca-certificates ccache rsync git \
procps bison python3 python3-pip python3-setuptools python3-wheel autoconf-archive
ln -sf /usr/bin/python3 /usr/bin/python
apt-get install -y ${{ matrix.packages }}
python3 -m pip install setuptools==70.3.0 --upgrade
python3 -m pip install lief
- name: Post install
if: ${{ matrix.postinstall }}
run: ${{ matrix.postinstall }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Clear depends cache
if: ${{ matrix.sdk }}
run: |
rm -rf depends/work
rm -rf depends/built
rm -rf depends/SDKs
- name: Fix permissions and init submodules
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git submodule update --init --recursive
chmod +x depends/config.guess depends/config.sub || true
- name: Install SDK
if: ${{ matrix.sdk }}
shell: bash
run: |
set -euo pipefail
mkdir -p depends/sdk-sources depends/SDKs
SDK_NAME="MacOSX11.0.sdk"
echo "Downloading macOS SDK ${{ matrix.sdk }} from phracker…"
curl -L --fail \
"https://github.com/phracker/MacOSX-SDKs/releases/download/11.0-11.1/${SDK_NAME}.tar.xz" \
-o "depends/sdk-sources/${SDK_NAME}.tar.xz"
echo "Verifying checksum…"
echo "${{ matrix.sdk-shasum }} depends/sdk-sources/${SDK_NAME}.tar.xz" | sha256sum -c
echo "Extracting SDK…"
tar -xf "depends/sdk-sources/${SDK_NAME}.tar.xz" -C depends/SDKs
# No rename needed, phracker uses correct directory name
echo "SDKROOT=$GITHUB_WORKSPACE/depends/SDKs/${SDK_NAME}" >> $GITHUB_ENV
echo "OSX_SDK_PATH=$GITHUB_WORKSPACE/depends/SDKs/${SDK_NAME}" >> $GITHUB_ENV
echo "OSX_SDK=${{ matrix.sdk }}" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.8" >> $GITHUB_ENV
echo "✅ SDK installed at depends/SDKs/${SDK_NAME}"
- name: Patch macOS SDK using 10.12 headers (merged all patches)
if: matrix.name == 'x86_64-macos'
shell: bash
run: |
set -euo pipefail
echo "🔧 Merged macOS SDK patch (10.12 → 11.0, stdarg fix + libc++ 11.0.0)"
SDK_TARGET="$GITHUB_WORKSPACE/depends/SDKs/MacOSX11.0.sdk"
SDK_PATCH_URL="https://github.com/phracker/MacOSX-SDKs/releases/download/11.0-11.1/MacOSX10.12.sdk.tar.xz"
SDK_PATCH_SHA="19121cfc324beb5c7222aa75a1e2834cbdd315b944674bbdc5387e7b6339c456"
LIBCXX_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/libcxx-11.0.0.src.tar.xz"
LIBCXX_SHA="6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
mkdir -p /tmp/sdkpatch
cd /tmp/sdkpatch
echo "📥 Downloading MacOSX10.12.sdk…"
curl -L --fail -o sdk.tar.xz "$SDK_PATCH_URL"
echo "🔐 Verifying SHA256 for SDK…"
echo "$SDK_PATCH_SHA sdk.tar.xz" | sha256sum -c
echo "📦 Extracting 10.12 SDK headers…"
tar -xf sdk.tar.xz "MacOSX10.12.sdk/usr/include"
PATCH_SRC="MacOSX10.12.sdk/usr/include"
echo "📁 Installing COMPLETE Darwin + C headers from 10.12 → 11.0…"
rsync -av --ignore-existing "$PATCH_SRC/" "$SDK_TARGET/usr/include/"
echo "📁 Injecting legacy C++ headers (c++/4.2.1)…"
mkdir -p "$SDK_TARGET/usr/include/c++"
cp -r "$PATCH_SRC/c++/4.2.1" "$SDK_TARGET/usr/include/c++/" || true
# Remove any old v1 folder (we replace it with libc++ 11)
if [ -L "$SDK_TARGET/usr/include/c++/v1" ] || [ -d "$SDK_TARGET/usr/include/c++/v1" ]; then
rm -rf "$SDK_TARGET/usr/include/c++/v1"
fi
echo "📄 Installing ONLY stdarg.h from LLVM 11 (others don't exist)…"
curl -L --fail \
"https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-11.0.0/clang/lib/Headers/stdarg.h" \
-o "$SDK_TARGET/usr/include/stdarg.h"
echo "🛠️ Creating required stdarg compatibility shims…"
cat > "$SDK_TARGET/usr/include/__stdarg_header_macro.h" <<'EOF'
#ifndef __STDARG_HEADER_MACRO_H
#define __STDARG_HEADER_MACRO_H
/* No-op shim for macOS cross-compile */
#endif
EOF
cat > "$SDK_TARGET/usr/include/__stdarg___gnuc_va_list.h" <<'EOF'
#ifndef __STDARG___GNUC_VA_LIST_H
#define __STDARG___GNUC_VA_LIST_H
typedef __builtin_va_list __gnuc_va_list;
#endif
EOF
cat > "$SDK_TARGET/usr/include/__stdarg_va_list.h" <<'EOF'
#ifndef __STDARG_VA_LIST_H
#define __STDARG_VA_LIST_H
typedef __builtin_va_list va_list;
#endif
EOF
cat > "$SDK_TARGET/usr/include/__stdarg_va_copy.h" <<'EOF'
#ifndef __STDARG_VA_COPY_H
#define __STDARG_VA_COPY_H
#define va_copy(dest, src) __builtin_va_copy(dest, src)
#endif
EOF
cat > "$SDK_TARGET/usr/include/__stdarg_va_arg.h" <<'EOF'
#ifndef __STDARG_VA_ARG_H
#define __STDARG_VA_ARG_H
#define va_arg(ap, type) __builtin_va_arg(ap, type)
#endif
EOF
echo "🛠️ Creating missing shim: __gnuc_va_list.h"
cat > "$SDK_TARGET/usr/include/__gnuc_va_list.h" <<'EOF'
#ifndef __GNUC_VA_LIST_H
#define __GNUC_VA_LIST_H
#include <stdarg.h>
typedef __builtin_va_list __gnuc_va_list;
#endif
EOF
echo "📦 Downloading libc++ 11.0.0 sources…"
curl -L --fail -o libcxx-11.0.0.src.tar.xz "$LIBCXX_URL"
echo "🔐 Verifying SHA256 for libc++ 11.0.0…"
echo "$LIBCXX_SHA libcxx-11.0.0.src.tar.xz" | sha256sum -c
mkdir -p /tmp/libcxx11
tar -xf libcxx-11.0.0.src.tar.xz -C /tmp/libcxx11
LIBCXX_INC="/tmp/libcxx11/libcxx-11.0.0.src/include"
if [ ! -d "$LIBCXX_INC" ]; then
echo "❌ libc++ 11 include dir not found at: $LIBCXX_INC"
exit 1
fi
echo "📁 Installing libc++ 11.0.0 headers into SDK (c++/v1)…"
rm -rf "$SDK_TARGET/usr/include/c++/v1"
mkdir -p "$SDK_TARGET/usr/include/c++/v1"
cp -R "$LIBCXX_INC/"* "$SDK_TARGET/usr/include/c++/v1/"
echo "📄 Installing __config_site"
if [ -f "$LIBCXX_INC/__config_site.in" ]; then
cp "$LIBCXX_INC/__config_site.in" "$SDK_TARGET/usr/include/c++/v1/__config_site"
else
echo "#ifndef _LIBCPP_CONFIG_SITE
#define _LIBCPP_CONFIG_SITE
#define _LIBCPP_HARDENING_MODE_DEFAULT _LIBCPP_HARDENING_MODE_NONE
#endif" > "$SDK_TARGET/usr/include/c++/v1/__config_site"
fi
echo "🧪 Sanity check: libc++ headers (v1)"
REQUIRED_CPP_V1=(type_traits utility tuple memory string vector algorithm new)
for hdr in "${REQUIRED_CPP_V1[@]}"; do
if [ ! -f "$SDK_TARGET/usr/include/c++/v1/$hdr" ]; then
echo "❌ Missing libc++ v1 header: $hdr"
exit 1
fi
done
echo "🧪 Sanity check: legacy C++ headers (4.2.1)"
REQUIRED_CPP_421=(cstddef iostream)
for hdr in "${REQUIRED_CPP_421[@]}"; do
if [ ! -f "$SDK_TARGET/usr/include/c++/4.2.1/$hdr" ]; then
echo "❌ Missing legacy C++ 4.2.1 header: $hdr"
exit 1
fi
done
echo "🧪 Sanity check: basic C system headers"
REQUIRED_C=(stdarg.h stddef.h stdint.h stdio.h errno.h unistd.h ctype.h stdlib.h)
for hdr in "${REQUIRED_C[@]}"; do
if [ ! -f "$SDK_TARGET/usr/include/$hdr" ]; then
echo "❌ Missing C header: $hdr"
exit 1
fi
done
echo "🧪 Sanity check: Darwin folders"
for dir in sys machine pthread dispatch; do
if [ ! -d "$SDK_TARGET/usr/include/$dir" ]; then
echo "❌ Missing Darwin folder: $dir"
exit 1
fi
done
echo "✅ macOS SDK fully patched — COMPLETE Darwin + C runtime, stdarg family shims, libc++ 11.0.0 v1, and legacy 4.2.1 installed."
- name: Configure macOS toolchain env
if: matrix.name == 'x86_64-macos'
shell: bash
run: |
SDK_PATH="$GITHUB_WORKSPACE/depends/SDKs/MacOSX11.0.sdk"
echo "Using SDK: $SDK_PATH"
if [ ! -d "$SDK_PATH" ]; then
echo "❌ SDK directory missing!"
ls -R depends/SDKs
exit 1
fi
# Only expose SDK info; let depends/toolchain handle flags
echo "SDKROOT=$SDK_PATH" >> $GITHUB_ENV
echo "OSX_SDK_PATH=$SDK_PATH" >> $GITHUB_ENV
echo "OSX_SDK=${{ matrix.sdk }}" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.8" >> $GITHUB_ENV
echo "🔧 macOS cross-compile environment configured (no global sysroot flags)."
# - name: Build depends
# run: make $MAKEJOBS -C depends HOST=${{ matrix.host }} ${{ matrix.dep-opts }}
- name: Build depends (non-mac)
if: matrix.name != 'x86_64-macos'
run: make $MAKEJOBS -C depends HOST=${{ matrix.host }} ${{ matrix.dep-opts }}
- name: Build depends (macOS)
if: matrix.name == 'x86_64-macos'
shell: bash
run: |
set -e
echo "▶ macOS depends build starting…"
export V=1
# Prevent timeout
( while true; do echo "❤️ still building mac depends…"; sleep 60; done ) &
echo "▶ Scanning depends/ for Darwin toolchain…"
echo "----------------------------------------"
find depends -maxdepth 5 -type f \( -name "clang" -o -name "clang++" -o -name "*-ar" -o -name "*-ranlib" \) -print || true
echo "----------------------------------------"
echo "▶ Auto-detecting REAL clang toolchain…"
# Try all known possible toolchain install paths
CANDIDATES=(
"depends/x86_64-apple-darwin11/native/bin"
"depends/native/bin"
"depends/*/native/bin"
"depends/*/*/bin"
"depends/*/toolchain/bin"
"depends/work/build/*/native_cctools/*/toolchain/bin"
)
REAL_TC=""
for DIR in "${CANDIDATES[@]}"; do
MATCH=$(ls -d $DIR 2>/dev/null || true)
if [ -n "$MATCH" ]; then
if [ -f "$MATCH/clang" ]; then
REAL_TC="$MATCH"
break
fi
fi
done
if [ -z "$REAL_TC" ]; then
echo "❌ FAILED TO FIND DARWIN TOOLCHAIN"
echo "Dumping directory structure for debugging:"
find depends -maxdepth 4 | sed 's/^/ /'
exit 1
fi
echo "✅ Found Darwin toolchain at: $REAL_TC"
ls -l "$REAL_TC"
# Export compilers
export PATH="$REAL_TC:$PATH"
export CC="$REAL_TC/clang"
export CXX="$REAL_TC/clang++"
# Also setup binutils
export AR=$(ls "$REAL_TC"/*-ar | head -n1)
export RANLIB=$(ls "$REAL_TC"/*-ranlib | head -n1)
export STRIP=$(ls "$REAL_TC"/*-strip | head -n1)
echo "▶ Using CC=$CC"
echo "▶ Using CXX=$CXX"
echo "▶ Using AR=$AR"
echo "▶ Using RANLIB=$RANLIB"
echo "▶ Using STRIP=$STRIP"
echo "▶ Building macOS depends with HOST=x86_64-apple-darwin11…"
make $MAKEJOBS -C depends HOST=x86_64-apple-darwin11
- name: Build AdventureCoin
env:
GIT_COMMIT_ID: ${{ github.sha }}
run: |
chmod +x autogen.sh
chmod -R +x depends || true
chmod +x share/genbuild.sh
SHORT_COMMIT=$(echo "$GIT_COMMIT_ID" | cut -c1-7)
depends/${{ matrix.host }}/native/bin/ccache --max-size=$CCACHE_SIZE
./autogen.sh
chmod +x configure || true
./configure --prefix=`pwd`/depends/${{ matrix.host }} ${{ matrix.config-opts }} --enable-reduce-exports \
CFLAGS="-std=c++17 -DGIT_COMMIT_ID=\\\"$SHORT_COMMIT\\\"" \
CXXFLAGS="-std=c++17 -DGIT_COMMIT_ID=\\\"$SHORT_COMMIT\\\"" || ( cat config.log && false)
make $MAKEJOBS ${{ matrix.goal }} CXXFLAGS="-std=c++17" || (echo "Build failure. Verbose build follows." && make ${{ matrix.goal }} CXXFLAGS="-std=c++17" V=1 ; false)
- name: Run benchmark
if: ${{ matrix.run-bench }}
run: |
src/bench/bench_adventurecoin > ${{ matrix.name }}-bench.csv
cat ${{ matrix.name }}-bench.csv
- name: Fix permissions for security-check.py
run: chmod +x contrib/devtools/security-check.py
- name: Check security
if: ${{ matrix.check-security }}
run: make -C src check-security
- name: Check symbols
if: ${{ matrix.check-symbols }}
run: make -C src check-symbols
- name: Cleanup qa artifacts
run: rm -rf qa/cache || true
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: adventurecoin-${{ github.sha }}-${{ matrix.name }}
path: |
depends/${{ matrix.host }}/bin/adventurecoin*
depends/${{ matrix.host }}/lib/libbitcoinconsensus*
depends/${{ matrix.host }}/include/bitcoinconsensus.h
depends/${{ matrix.host }}/share/man/man1/adventurecoin*
dist/AdventureCoin-Qt.app
AdventureCoin-Core.dmg
${{ matrix.name }}-bench.csv