ci: Test cross-built Windows executables on Windows natively #3490
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2023 The Bitcoin Core developers | |
# Distributed under the MIT software license, see the accompanying | |
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
name: CI | |
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.event_name != 'pull_request' && github.run_id || github.ref }} | |
cancel-in-progress: true | |
env: | |
CI_FAILFAST_TEST_LEAVE_DANGLING: 1 # GHA does not care about dangling processes and setting this variable avoids killing the CI script itself on error | |
MAKEJOBS: '-j10' | |
jobs: | |
windows-cross-build: | |
runs-on: ubuntu-latest | |
name: Cross-build to Windows | |
container: debian:bookworm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install required packages | |
run: | | |
apt-get update | |
apt-get install --no-install-recommends -y build-essential pkg-config curl ca-certificates ccache python3 cmake nsis g++-mingw-w64-x86-64-posix | |
- name: Build depends | |
working-directory: depends | |
run: | | |
make -j$(nproc) HOST=x86_64-w64-mingw32 LOG=1 NO_QT=1 | |
- name: Generate build system | |
# Using the "Release" build type to avoid oversized executables for the following job. | |
run: | | |
cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCH=ON | |
- name: Build | |
run: | | |
cmake --build build -j $(nproc) | |
- name: Upload built executables | |
uses: actions/upload-artifact@v4 | |
with: | |
name: x86_64-w64-mingw32-executables-${{ github.run_id }} | |
path: | | |
build/src/bitcoind.exe | |
build/src/test/test_bitcoin.exe | |
build/src/bench/bench_bitcoin.exe | |
windows-native-test: | |
runs-on: windows-2022 | |
needs: windows-cross-build | |
name: Test on Windows | |
steps: | |
- name: Download built executables | |
uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-w64-mingw32-executables-${{ github.run_id }} | |
- name: Run bitcoind.exe | |
run: | | |
.\bitcoind.exe -version | |
- name: Run benchmarks | |
run: | | |
.\bench\bench_bitcoin.exe -sanity-check -priority-level=high | |
- name: Run tests | |
run: | | |
.\test\test_bitcoin.exe |