Switch to llvm-mingw for faster Windows CI (#5729)

* Switch to llvm-mingw for faster Windows CI

* Enable ubsan of Windows CI
This commit is contained in:
andri lim 2024-01-13 16:45:20 +07:00 committed by GitHub
parent 00d05f8170
commit a45609c4a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 17 deletions

View File

@ -56,19 +56,16 @@ jobs:
- target:
os: linux
builder: ['self-hosted','ubuntu-22.04']
shell: bash
- target:
os: macos
builder: macos-11
shell: bash
- target:
os: windows
builder: windows-2019
shell: msys2 {0}
defaults:
run:
shell: ${{ matrix.shell }}
shell: bash
name: ${{ matrix.target.os }}-${{ matrix.target.cpu }}${{ matrix.branch != '' && ' (Nim ' || '' }}${{ matrix.branch-short }}${{ matrix.branch != '' && ')' || '' }}
runs-on: ${{ matrix.builder }}
@ -76,16 +73,25 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: MSYS2 (Windows amd64)
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
uses: msys2/setup-msys2@v2
- name: Restore llvm-mingw (Windows) from cache
if: runner.os == 'Windows'
id: windows-mingw-cache
uses: actions/cache@v3
with:
path-type: inherit
install: >-
base-devel
git
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
path: external/mingw-${{ matrix.target.cpu }}
key: 'mingw-llvm-17-${{ matrix.target.cpu }}'
- name: Install llvm-mingw dependency (Windows)
if: >
steps.windows-mingw-cache.outputs.cache-hit != 'true' &&
runner.os == 'Windows'
run: |
mkdir -p external
MINGW_BASE="https://github.com/mstorsjo/llvm-mingw/releases/download/20230905"
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
curl -L "$MINGW_URL" -o "external/mingw-${{ matrix.target.cpu }}.zip"
7z x -y "external/mingw-${{ matrix.target.cpu }}.zip" -oexternal/mingw-${{ matrix.target.cpu }}/
mv external/mingw-${{ matrix.target.cpu }}/**/* ./external/mingw-${{ matrix.target.cpu }}
- name: Restore Nim DLLs dependencies (Windows) from cache
if: runner.os == 'Windows'
@ -108,6 +114,7 @@ jobs:
if: >
runner.os == 'Windows'
run: |
echo '${{ github.workspace }}'"/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
# for miniupnp that runs "wingenminiupnpcstrings.exe" from the current dir
echo "." >> $GITHUB_PATH

View File

@ -1,4 +1,4 @@
# Copyright (c) 2019-2023 Status Research & Development GmbH. Licensed under
# Copyright (c) 2019-2024 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
@ -775,7 +775,6 @@ libnimbus_lc.a: | build deps
echo -e $(BUILD_END_MSG) "build/$@"
# `-Wno-maybe-uninitialized` in Linux: https://github.com/nim-lang/Nim/issues/22246
# `-fsanitize=undefined` in Windows: https://github.com/msys2/MINGW-packages/issues/3163
# `-Wl,--stack,0x0000000000800000` in Windows: MinGW default of 2 MB leads to `SIGSEGV` in `___chkstk_ms` in Nim 2.0
test_libnimbus_lc: libnimbus_lc.a
+ echo -e $(BUILD_MSG) "build/$@" && \
@ -789,9 +788,9 @@ test_libnimbus_lc: libnimbus_lc.a
;; \
MINGW64_*) \
if (( $${WITH_UBSAN:-0} )); then \
echo "MINGW cannot find -lubsan." && exit 1; \
EXTRA_FLAGS+=('-fsanitize=undefined'); \
fi; \
gcc -D__DIR__="\"beacon_chain/libnimbus_lc\"" --std=c17 -Wall -Wextra -pedantic -Werror -pedantic-errors -flto -Wl,--stack,0x0000000000800000 -o build/test_libnimbus_lc -D_CRT_SECURE_NO_WARNINGS beacon_chain/libnimbus_lc/test_libnimbus_lc.c build/libnimbus_lc.a "$${EXTRA_FLAGS[@]}"; \
gcc -D__DIR__="\"beacon_chain/libnimbus_lc\"" --std=c17 -Wall -Wextra -pedantic -Werror -pedantic-errors -flto -Wno-nullability-extension -Wl,--stack,0x0000000000800000 -o build/test_libnimbus_lc -D_CRT_SECURE_NO_WARNINGS beacon_chain/libnimbus_lc/test_libnimbus_lc.c build/libnimbus_lc.a "$${EXTRA_FLAGS[@]}"; \
;; \
*) \
if (( $${WITH_UBSAN:-0} )); then \