Skip to content

Commit 3358b1d

Browse files
committed
Merge bitcoin/bitcoin#31176: ci: Test cross-built Windows executables on Windows natively
25b56fd ci: Test cross-built Windows executables on Windows natively (Hennadii Stepanov) 3501bca ci: Move "Windows cross" job from Cirrus CI to GHA CI (Hennadii Stepanov) f861919 ci: Use `bash` by default for all platforms (Hennadii Stepanov) Pull request description: This PR enables on the CI tests of cross-compiled Windows binaries on Windows. It is important to have such tests in CI because the release binaries for Windows are also cross-compiled. Two functional tests, `wallet_migration.py` and `wallet_multiwallet.py`, are temporarily disabled. They require fixes, such as bitcoin/bitcoin#31410, and adjustments for error message handling. Re-enabling these tests will be addressed in follow-up PRs. Resolves bitcoin/bitcoin#31071. ACKs for top commit: davidgumberg: tested reACK bitcoin/bitcoin@25b56fd hodlinator: re-ACK 25b56fd willcl-ark: utACK 25b56fd maflcko: review-only ACK 25b56fd 🍎 Tree-SHA512: fb9150807b7ebb248e8f4fe7b16e5179251e7be9336459287787f27e542583d73d937e6969667fd836378b676bb9be7f66756dc1abca8a01364bc9ee3e3720a5
2 parents 4c1906a + 25b56fd commit 3358b1d

File tree

5 files changed

+130
-54
lines changed

5 files changed

+130
-54
lines changed

.cirrus.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,6 @@ task:
124124
env:
125125
FILE_ENV: "./ci/test/00_setup_env_arm.sh"
126126

127-
task:
128-
name: 'Win64-cross'
129-
<< : *GLOBAL_TASK_TEMPLATE
130-
persistent_worker:
131-
labels:
132-
type: small
133-
env:
134-
FILE_ENV: "./ci/test/00_setup_env_win64.sh"
135-
136127
task:
137128
name: 'CentOS, depends, gui'
138129
<< : *GLOBAL_TASK_TEMPLATE

.github/workflows/ci.yml

Lines changed: 128 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ env:
2121
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
2222
MAKEJOBS: '-j10'
2323

24+
defaults:
25+
run:
26+
# Enforce fail-fast behavior for all platforms.
27+
# See: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
28+
shell: bash
29+
2430
jobs:
2531
test-each-commit:
2632
name: 'test each commit'
@@ -150,7 +156,7 @@ jobs:
150156
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
151157
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
152158

153-
win64-native:
159+
windows-native:
154160
name: ${{ matrix.job-name }}
155161
# Use latest image, but hardcode version to avoid silent upgrades (and breaks).
156162
# See: https://github.com/actions/runner-images#available-images.
@@ -169,10 +175,10 @@ jobs:
169175
include:
170176
- job-type: standard
171177
generate-options: '-DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON'
172-
job-name: 'Win64 native, VS 2022'
178+
job-name: 'Windows native, VS 2022'
173179
- job-type: fuzz
174180
generate-options: '-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet" -DBUILD_GUI=OFF -DBUILD_FOR_FUZZING=ON -DWERROR=ON'
175-
job-name: 'Win64 native fuzz, VS 2022'
181+
job-name: 'Windows native, fuzz, VS 2022'
176182

177183
steps:
178184
- name: Checkout
@@ -185,19 +191,20 @@ jobs:
185191
arch: x64
186192

187193
- name: Get tool information
194+
shell: pwsh
188195
run: |
189196
cmake -version | Tee-Object -FilePath "cmake_version"
190197
Write-Output "---"
191198
msbuild -version | Tee-Object -FilePath "msbuild_version"
192199
$env:VCToolsVersion | Tee-Object -FilePath "toolset_version"
193200
py -3 --version
194201
Write-Host "PowerShell version $($PSVersionTable.PSVersion.ToString())"
202+
bash --version
195203
196204
- name: Using vcpkg with MSBuild
197205
run: |
198-
Set-Location "$env:VCPKG_INSTALLATION_ROOT"
199-
Add-Content -Path "triplets\x64-windows.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
200-
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
206+
echo "set(VCPKG_BUILD_TYPE release)" >> "${VCPKG_INSTALLATION_ROOT}/triplets/x64-windows.cmake"
207+
echo "set(VCPKG_BUILD_TYPE release)" >> "${VCPKG_INSTALLATION_ROOT}/triplets/x64-windows-static.cmake"
201208
202209
- name: vcpkg tools cache
203210
uses: actions/cache@v4
@@ -214,7 +221,7 @@ jobs:
214221

215222
- name: Generate build system
216223
run: |
217-
cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" ${{ matrix.generate-options }}
224+
cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" ${{ matrix.generate-options }}
218225
219226
- name: Save vcpkg binary cache
220227
uses: actions/cache/save@v4
@@ -226,13 +233,13 @@ jobs:
226233
- name: Build
227234
working-directory: build
228235
run: |
229-
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release
236+
cmake --build . -j $NUMBER_OF_PROCESSORS --config Release
230237
231238
- name: Run test suite
232239
if: matrix.job-type == 'standard'
233240
working-directory: build
234241
run: |
235-
ctest --output-on-failure --stop-on-failure -j $env:NUMBER_OF_PROCESSORS -C Release
242+
ctest --output-on-failure --stop-on-failure -j $NUMBER_OF_PROCESSORS -C Release
236243
237244
- name: Run functional tests
238245
if: matrix.job-type == 'standard'
@@ -243,25 +250,130 @@ jobs:
243250
BITCOINUTIL: '${{ github.workspace }}\build\bin\Release\bitcoin-util.exe'
244251
BITCOINWALLET: '${{ github.workspace }}\build\bin\Release\bitcoin-wallet.exe'
245252
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
246-
shell: cmd
247-
run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %TEST_RUNNER_EXTRA%
253+
run: py -3 test/functional/test_runner.py --jobs $NUMBER_OF_PROCESSORS --ci --quiet --tmpdirprefix="${RUNNER_TEMP}" --combinedlogslen=99999999 --timeout-factor=${TEST_RUNNER_TIMEOUT_FACTOR} ${TEST_RUNNER_EXTRA}
248254

249255
- name: Clone corpora
250256
if: matrix.job-type == 'fuzz'
251257
run: |
252-
git clone --depth=1 https://github.com/bitcoin-core/qa-assets "$env:RUNNER_TEMP\qa-assets"
253-
Set-Location "$env:RUNNER_TEMP\qa-assets"
254-
Write-Host "Using qa-assets repo from commit ..."
258+
git clone --depth=1 https://github.com/bitcoin-core/qa-assets "${RUNNER_TEMP}/qa-assets"
259+
cd "${RUNNER_TEMP}/qa-assets"
260+
echo "Using qa-assets repo from commit ..."
255261
git log -1
256262
257263
- name: Run fuzz tests
258264
if: matrix.job-type == 'fuzz'
259265
working-directory: build
260266
env:
261267
BITCOINFUZZ: '${{ github.workspace }}\build\bin\Release\fuzz.exe'
262-
shell: cmd
263268
run: |
264-
py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_corpora
269+
py -3 test/fuzz/test_runner.py --par $NUMBER_OF_PROCESSORS --loglevel DEBUG "${RUNNER_TEMP}/qa-assets/fuzz_corpora"
270+
271+
windows-cross:
272+
name: 'Linux->Windows cross, no tests'
273+
runs-on: ubuntu-latest
274+
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
275+
276+
env:
277+
FILE_ENV: './ci/test/00_setup_env_win64.sh'
278+
DANGER_CI_ON_HOST_FOLDERS: 1
279+
280+
steps:
281+
- name: Checkout
282+
uses: actions/checkout@v4
283+
284+
- name: Set CI directories
285+
run: |
286+
echo "CCACHE_DIR=${{ runner.temp }}/ccache_dir" >> "$GITHUB_ENV"
287+
echo "BASE_ROOT_DIR=${{ runner.temp }}" >> "$GITHUB_ENV"
288+
echo "DEPENDS_DIR=${{ runner.temp }}/depends" >> "$GITHUB_ENV"
289+
echo "BASE_BUILD_DIR=${{ runner.temp }}/build" >> "$GITHUB_ENV"
290+
291+
- name: Depends cache
292+
uses: actions/cache@v4
293+
with:
294+
path: ${{ env.DEPENDS_DIR }}/built
295+
key: ${{ github.job }}-depends-${{ hashFiles('depends/**', 'ci/test/00_setup_env_win64.sh') }}
296+
297+
- name: Restore Ccache cache
298+
id: ccache-cache
299+
uses: actions/cache/restore@v4
300+
with:
301+
path: ${{ env.CCACHE_DIR }}
302+
key: ${{ github.job }}-ccache-${{ github.run_id }}
303+
restore-keys: ${{ github.job }}-ccache-
304+
305+
- name: CI script
306+
run: ./ci/test_run_all.sh
307+
308+
- name: Save Ccache cache
309+
uses: actions/cache/save@v4
310+
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
311+
with:
312+
path: ${{ env.CCACHE_DIR }}
313+
key: ${{ github.job }}-ccache-${{ github.run_id }}
314+
315+
- name: Upload built executables
316+
uses: actions/upload-artifact@v4
317+
with:
318+
name: x86_64-w64-mingw32-executables-${{ github.run_id }}
319+
path: |
320+
${{ env.BASE_BUILD_DIR }}/bin/*.exe
321+
${{ env.BASE_BUILD_DIR }}/src/secp256k1/bin/*.exe
322+
${{ env.BASE_BUILD_DIR }}/src/univalue/*.exe
323+
${{ env.BASE_BUILD_DIR }}/test/config.ini
324+
325+
windows-native-test:
326+
name: 'Windows, test cross-built'
327+
runs-on: windows-2022
328+
needs: windows-cross
329+
330+
env:
331+
PYTHONUTF8: 1
332+
TEST_RUNNER_TIMEOUT_FACTOR: 40
333+
334+
steps:
335+
- name: Checkout
336+
uses: actions/checkout@v4
337+
338+
- name: Download built executables
339+
uses: actions/download-artifact@v4
340+
with:
341+
name: x86_64-w64-mingw32-executables-${{ github.run_id }}
342+
343+
- name: Run bitcoind.exe
344+
run: ./bin/bitcoind.exe -version
345+
346+
- name: Run unit tests
347+
# Can't use ctest here like other jobs as we don't have a CMake build tree.
348+
run: |
349+
./bin/test_bitcoin.exe -l test_suite
350+
./src/secp256k1/bin/exhaustive_tests.exe
351+
./src/secp256k1/bin/noverify_tests.exe
352+
./src/secp256k1/bin/tests.exe
353+
./src/univalue/object.exe
354+
./src/univalue/unitester.exe
355+
356+
- name: Run benchmarks
357+
run: ./bin/bench_bitcoin.exe -sanity-check -priority-level=high
358+
359+
- name: Adjust paths in test/config.ini
360+
shell: pwsh
361+
run: |
362+
(Get-Content "test/config.ini") -replace '(?<=^SRCDIR=).*', '${{ github.workspace }}' -replace '(?<=^BUILDDIR=).*', '${{ github.workspace }}' -replace '(?<=^RPCAUTH=).*', '${{ github.workspace }}/share/rpcauth/rpcauth.py' | Set-Content "test/config.ini"
363+
Get-Content "test/config.ini"
364+
365+
- name: Run util tests
366+
run: py -3 test/util/test_runner.py
367+
368+
- name: Run rpcauth test
369+
run: py -3 test/util/rpcauth-test.py
370+
371+
- name: Run functional tests
372+
env:
373+
# TODO: Fix the excluded tests and re-enable them.
374+
EXCLUDE: '--exclude wallet_migration.py,wallet_multiwallet.py'
375+
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
376+
run: py -3 test/functional/test_runner.py --jobs $NUMBER_OF_PROCESSORS --ci --quiet --tmpdirprefix="$RUNNER_TEMP" --combinedlogslen=99999999 --timeout-factor=$TEST_RUNNER_TIMEOUT_FACTOR $EXCLUDE $TEST_RUNNER_EXTRA
265377

266378
asan-lsan-ubsan-integer-no-depends-usdt:
267379
name: 'ASan + LSan + UBSan + integer, no depends, USDT'

ci/test/00_setup_env_win64.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ export CONTAINER_NAME=ci_win64
1010
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:noble" # Check that g++-mingw-w64-x86-64-posix (version 13.2, similar to guix) can cross-compile
1111
export CI_IMAGE_PLATFORM="linux/amd64"
1212
export HOST=x86_64-w64-mingw32
13-
export DPKG_ADD_ARCH="i386"
14-
export PACKAGES="nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file"
15-
# Install wine, but do not run unit tests, as they surface frequent
16-
# false-positives.
17-
export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-false}
13+
export PACKAGES="g++-mingw-w64-x86-64-posix nsis"
14+
export RUN_UNIT_TESTS=false
1815
export RUN_FUNCTIONAL_TESTS=false
1916
export GOAL="deploy"
2017
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_GUI_TESTS=OFF \

ci/test/03_test_script.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ bash -c "${PRINT_CCACHE_STATISTICS}"
132132
du -sh "${DEPENDS_DIR}"/*/
133133
du -sh "${PREVIOUS_RELEASES_DIR}"
134134

135-
if [[ $HOST = *-mingw32 ]]; then
136-
"${BASE_ROOT_DIR}/ci/test/wrap-wine.sh"
137-
fi
138-
139135
if [ -n "$USE_VALGRIND" ]; then
140136
"${BASE_ROOT_DIR}/ci/test/wrap-valgrind.sh"
141137
fi

ci/test/wrap-wine.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)