Skip to content

Add if: ${{ matrix.host.build_type != release }} #49

Add if: ${{ matrix.host.build_type != release }}

Add if: ${{ matrix.host.build_type != release }} #49

Workflow file for this run

# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
name: CMake
on:
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request.
pull_request:
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push.
push:
branches:
- '**'
tags-ignore:
- '**'
concurrency:
group: ${{ github.workflow }}${{ github.event_name != 'pull_request' && github.run_id || github.ref }}
cancel-in-progress: true
jobs:
build-info:
name: 'Test obj/build.h generation'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: cp cmake/script/GenerateBuildInfo.cmake ${{ runner.temp }}
- name: Test at HEAD
run: |
rm -rf src/obj build/src/obj
mkdir -p src/obj build/src/obj
./share/genbuild.sh ${PWD}/src/obj/build.h ${PWD}
cmake -DBUILD_INFO_HEADER_PATH=${PWD}/build/src/obj/build.h -DSOURCE_DIR=${PWD} -P ${{ runner.temp }}/GenerateBuildInfo.cmake
cat src/obj/build.h
diff -u src/obj/build.h build/src/obj/build.h
- name: Test out of tree
run: |
rm -rf src/obj build/src/obj
mkdir -p src/obj build/src/obj
./share/genbuild.sh ${PWD}/src/obj/build.h ${{ runner.temp }}
cmake -DBUILD_INFO_HEADER_PATH=${PWD}/build/src/obj/build.h -DSOURCE_DIR=${{ runner.temp }} -P ${{ runner.temp }}/GenerateBuildInfo.cmake
cat src/obj/build.h
diff -u src/obj/build.h build/src/obj/build.h
- name: Test at tag
run: |
rm -rf src/obj build/src/obj
mkdir -p src/obj build/src/obj
git -c advice.detachedHead=false checkout v25.1
./share/genbuild.sh ${PWD}/src/obj/build.h ${PWD}
cmake -DBUILD_INFO_HEADER_PATH=${PWD}/build/src/obj/build.h -DSOURCE_DIR=${PWD} -P ${{ runner.temp }}/GenerateBuildInfo.cmake
cat src/obj/build.h
diff -u src/obj/build.h build/src/obj/build.h
- name: Test dirty tree
run: |
rm -rf src/obj build/src/obj
mkdir -p src/obj build/src/obj
echo "test" >> README.md
./share/genbuild.sh ${PWD}/src/obj/build.h ${PWD}
cmake -DBUILD_INFO_HEADER_PATH=${PWD}/build/src/obj/build.h -DSOURCE_DIR=${PWD} -P ${{ runner.temp }}/GenerateBuildInfo.cmake
cat src/obj/build.h
diff -u src/obj/build.h build/src/obj/build.h
- name: Test BITCOIN_GENBUILD_NO_GIT
env:
BITCOIN_GENBUILD_NO_GIT: '1'
run: |
rm -rf src/obj build/src/obj
mkdir -p src/obj build/src/obj
./share/genbuild.sh ${PWD}/src/obj/build.h ${PWD}
cmake -DBUILD_INFO_HEADER_PATH=${PWD}/build/src/obj/build.h -DSOURCE_DIR=${PWD} -P ${{ runner.temp }}/GenerateBuildInfo.cmake
cat src/obj/build.h
diff -u src/obj/build.h build/src/obj/build.h
cross-build:
name: ${{ matrix.host.name }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
host:
- name: 'Linux 32-bit, Clang, link to libatomic'
packages: 'clang-14 g++-multilib'
triplet: 'i686-pc-linux-gnu'
c_compiler: 'clang-14 -m32'
cxx_compiler: 'clang++-14 -m32'
depends_options: 'NO_QT=1'
configure_options: '-DWERROR=ON'
env:
CCACHE_MAXSIZE: '120M'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependency packages
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends ccache ${{ matrix.host.packages }}
echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV"
- name: Depends fingerprint
id: depends_fingerprint
run: |
${{ matrix.host.c_compiler }} -v 2>&1 | tee depends/c_compiler_version
${{ matrix.host.cxx_compiler }} -v 2>&1 | tee depends/cxx_compiler_version
echo ${{ matrix.host.depends_options }} > depends/depends_options
echo "hash=${{ hashFiles('./depends/**') }}" >> "$GITHUB_OUTPUT"
- name: Depends cache
id: depends_cache
uses: actions/cache@v3
with:
path: |
depends/built
key: ${{ matrix.host.triplet }}-depends-${{ steps.depends_fingerprint.outputs.hash }}
- name: Build depends
run: |
cd depends
make -j$(nproc) HOST=${{ matrix.host.triplet }} CC='${{ matrix.host.c_compiler }}' CXX='${{ matrix.host.cxx_compiler }}' ${{ matrix.host.depends_options }} LOG=1
- name: Restore Ccache cache
uses: actions/cache/restore@v3
id: ccache-cache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.host.triplet }}-ccache-${{ github.run_id }}
restore-keys: ${{ matrix.host.triplet }}-ccache-
- name: Generate build system
run: |
cmake -B build --toolchain depends/${{ matrix.host.triplet }}/share/toolchain.cmake ${{ matrix.host.configure_options }}
- name: Build
run: |
ccache --zero-stats
cmake --build build -j $(nproc)
ccache --version | head -n 1 && ccache --show-stats
file build/src/bitcoind
- name: Save Ccache cache
uses: actions/cache/save@v3
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.host.triplet }}-ccache-${{ github.run_id }}
- name: Check
run: |
ctest --test-dir build -j $(nproc)
win64-native:
name: ${{ matrix.host.name }}
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
host:
- name: 'Win64 native, VS 2022, release & debug'
build_type: ''
- name: 'Win64 native, VS 2022, release-only'
build_type: 'release'
# Building boost-exception:x64-windows-static fails in debug-only configuration.
# - name: 'Win64 native, VS 2022, debug-only'
# build_type: 'debug'
env:
CCACHE_MAXSIZE: '120M'
CI_VCPKG_TAG: '2023.08.09'
VCPKG_DEFAULT_TRIPLET: 'x64-windows-static'
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Fix Visual Studio installation
# # Avoid toolset ambiguity that MSVC can't handle.
# run: |
# Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
# $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
# $componentsToRemove= @(
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM64.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM64"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM64.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM64"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM64.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM64"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.x86.x64.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.37.17.7.x86.x64"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.Spectre"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64"
# "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64.Spectre"
# )
# [string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
# $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# # should be run twice
# $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
# $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
- name: Configure Developer Command Prompt for Microsoft Visual C++
# Using microsoft/setup-msbuild is not enough.
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Setup vcpkg
run: |
Set-Location "$env:VCPKG_INSTALLATION_ROOT"
git -c advice.detachedHead=false checkout "$env:CI_VCPKG_TAG"
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE ${{ matrix.host.build_type }})"
vcpkg --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install
git rev-parse HEAD | Out-File -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit"
"CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install dependency packages
run: |
vcpkg install pkgconf berkeleydb boost-date-time boost-multi-index boost-signals2 boost-test libevent miniupnpc sqlite3 zeromq
- name: Generate build system
run: |
cmake -B build -A x64 -DVCPKG_TARGET_TRIPLET="$env:VCPKG_DEFAULT_TRIPLET" -DWITH_NATPMP=OFF
- name: Build RelWithDebInfo configuration
run: |
cmake --build build -j $env:NUMBER_OF_PROCESSORS -t bitcoind --config RelWithDebInfo
- name: Build Debug configuration
if: ${{ matrix.host.build_type != 'release' }}
run: |
cmake --build build -j $env:NUMBER_OF_PROCESSORS -t bitcoind --config Debug
- name: Build Release configuration
run: |
cmake --build build -j $env:NUMBER_OF_PROCESSORS -t bitcoind --config Release
- name: Build MinSizeRel configuration
run: |
cmake --build build -j $env:NUMBER_OF_PROCESSORS -t bitcoind --config MinSizeRel