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

This commit is contained in:
andri lim 2023-09-08 22:10:16 +07:00 committed by GitHub
parent 348a9aea6f
commit db6bd9af16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 117 additions and 68 deletions

View File

@ -29,7 +29,6 @@ jobs:
- os: windows - os: windows
cpu: amd64 cpu: amd64
evmc: evmc evmc: evmc
# vm2
- os: linux - os: linux
cpu: amd64 cpu: amd64
evmc: nimvm evmc: nimvm
@ -46,19 +45,16 @@ jobs:
- target: - target:
os: linux os: linux
builder: ubuntu-20.04 builder: ubuntu-20.04
shell: bash
- target: - target:
os: macos os: macos
builder: macos-11 builder: macos-11
shell: bash
- target: - target:
os: windows os: windows
builder: windows-latest builder: windows-latest
shell: msys2 {0}
defaults: defaults:
run: run:
shell: ${{ matrix.shell }} shell: bash
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.target.evmc }}' name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.target.evmc }}'
runs-on: ${{ matrix.builder }} runs-on: ${{ matrix.builder }}
@ -67,7 +63,6 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Derive environment variables - name: Derive environment variables
shell: bash
run: | run: |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
PLATFORM=x64 PLATFORM=x64
@ -166,15 +161,13 @@ jobs:
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_rocksdb.sh curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_rocksdb.sh
bash build_rocksdb.sh rocks-db-cache-${{ matrix.target.cpu }} bash build_rocksdb.sh rocks-db-cache-${{ matrix.target.cpu }}
- name: MSYS2 (Windows amd64) - name: Restore llvm-mingw (Windows) from cache
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2 id: windows-mingw-cache
uses: actions/cache@v3
with: with:
path-type: inherit path: external/mingw-${{ matrix.target.cpu }}
install: >- key: 'mingw-llvm-17-${{ matrix.target.cpu }}'
base-devel
git
mingw-w64-x86_64-toolchain
- name: Restore Nim DLLs dependencies (Windows) from cache - name: Restore Nim DLLs dependencies (Windows) from cache
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -186,6 +179,24 @@ jobs:
# so change dlls# to force new cache contents (for some number #) # so change dlls# to force new cache contents (for some number #)
key: dlls0-${{ matrix.target.cpu }} key: dlls0-${{ 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"
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
ARCH=64
else
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-i686.zip"
ARCH=32
fi
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: Install DLLs dependencies (Windows) - name: Install DLLs dependencies (Windows)
if: > if: >
steps.windows-dlls-cache.outputs.cache-hit != 'true' && steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
@ -209,6 +220,7 @@ jobs:
if: > if: >
runner.os == 'Windows' runner.os == 'Windows'
run: | run: |
echo '${{ github.workspace }}'"/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
- name: Get latest nimbus-build-system commit hash - name: Get latest nimbus-build-system commit hash

View File

@ -109,19 +109,16 @@ jobs:
- target: - target:
os: linux os: linux
builder: ubuntu-22.04 builder: ubuntu-22.04
shell: bash
- target: - target:
os: macos os: macos
builder: macos-11 builder: macos-11
shell: bash
- target: - target:
os: windows os: windows
builder: windows-latest builder: windows-latest
shell: msys2 {0}
defaults: defaults:
run: run:
shell: ${{ matrix.shell }} shell: bash
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}' name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}'
runs-on: ${{ matrix.builder }} runs-on: ${{ matrix.builder }}
@ -130,7 +127,6 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Derive environment variables - name: Derive environment variables
shell: bash
run: | run: |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
PLATFORM=x64 PLATFORM=x64
@ -186,15 +182,13 @@ jobs:
brew install gnu-getopt brew install gnu-getopt
brew link --force gnu-getopt brew link --force gnu-getopt
- name: MSYS2 (Windows amd64) - name: Restore llvm-mingw (Windows) from cache
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2 id: windows-mingw-cache
uses: actions/cache@v3
with: with:
path-type: inherit path: external/mingw-${{ matrix.target.cpu }}
install: >- key: 'mingw-llvm-17-${{ matrix.target.cpu }}'
base-devel
git
mingw-w64-x86_64-toolchain
- name: Restore Nim DLLs dependencies (Windows) from cache - name: Restore Nim DLLs dependencies (Windows) from cache
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -204,6 +198,24 @@ jobs:
path: external/dlls-${{ matrix.target.cpu }} path: external/dlls-${{ matrix.target.cpu }}
key: 'dlls-${{ matrix.target.cpu }}-fluffy' key: 'dlls-${{ matrix.target.cpu }}-fluffy'
- 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"
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
ARCH=64
else
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
ARCH=32
fi
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: Install DLLs dependencies (Windows) - name: Install DLLs dependencies (Windows)
if: > if: >
steps.windows-dlls-cache.outputs.cache-hit != 'true' && steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
@ -218,6 +230,7 @@ jobs:
if: > if: >
runner.os == 'Windows' runner.os == 'Windows'
run: | run: |
echo '${{ github.workspace }}'"/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
- name: Get latest nimbus-build-system commit hash - name: Get latest nimbus-build-system commit hash

View File

@ -39,19 +39,16 @@ jobs:
- target: - target:
os: linux os: linux
builder: ubuntu-20.04 builder: ubuntu-20.04
shell: bash
- target: - target:
os: macos os: macos
builder: macos-11 builder: macos-11
shell: bash
- target: - target:
os: windows os: windows
builder: windows-latest builder: windows-latest
shell: msys2 {0}
defaults: defaults:
run: run:
shell: ${{ matrix.shell }} shell: bash
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}' name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}'
runs-on: ${{ matrix.builder }} runs-on: ${{ matrix.builder }}
@ -60,7 +57,6 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Derive environment variables - name: Derive environment variables
shell: bash
run: | run: |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
PLATFORM=x64 PLATFORM=x64
@ -116,26 +112,13 @@ jobs:
brew install gnu-getopt brew install gnu-getopt
brew link --force gnu-getopt brew link --force gnu-getopt
- name: MSYS2 (Windows i386) - name: Restore llvm-mingw (Windows) from cache
if: runner.os == 'Windows' && matrix.target.cpu == 'i386' if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2 id: windows-mingw-cache
uses: actions/cache@v3
with: with:
path-type: inherit path: external/mingw-${{ matrix.target.cpu }}
msystem: MINGW32 key: 'mingw-llvm-17-${{ matrix.target.cpu }}'
install: >-
base-devel
git
mingw-w64-i686-toolchain
- name: MSYS2 (Windows amd64)
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: >-
base-devel
git
mingw-w64-x86_64-toolchain
- name: Restore Nim DLLs dependencies (Windows) from cache - name: Restore Nim DLLs dependencies (Windows) from cache
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -145,6 +128,24 @@ jobs:
path: external/dlls-${{ matrix.target.cpu }} path: external/dlls-${{ matrix.target.cpu }}
key: 'dlls-${{ matrix.target.cpu }}-verified-proxy' key: 'dlls-${{ matrix.target.cpu }}-verified-proxy'
- 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"
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
ARCH=64
else
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
ARCH=32
fi
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: Install DLLs dependencies (Windows) - name: Install DLLs dependencies (Windows)
if: > if: >
steps.windows-dlls-cache.outputs.cache-hit != 'true' && steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
@ -159,6 +160,7 @@ jobs:
if: > if: >
runner.os == 'Windows' runner.os == 'Windows'
run: | run: |
echo '${{ github.workspace }}'"/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
- name: Get latest nimbus-build-system commit hash - name: Get latest nimbus-build-system commit hash

View File

@ -95,19 +95,31 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
defaults: defaults:
run: run:
shell: msys2 {0} shell: bash
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: MSYS2 - name: Restore llvm-mingw (Windows) from cache
uses: msys2/setup-msys2@v2 if: runner.os == 'Windows'
id: windows-mingw-cache
uses: actions/cache@v3
with: with:
path-type: inherit path: external/mingw-amd64
install: >- key: 'mingw-llvm-17-amd64'
base-devel
git - name: Install llvm-mingw dependency (Windows)
mingw-w64-x86_64-toolchain 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-amd64.zip"
7z x -y "external/mingw-amd64.zip" -oexternal/mingw-amd64/
mv external/mingw-amd64/**/* ./external/mingw-amd64
echo '${{ github.workspace }}'"/external/mingw-amd64/bin" >> $GITHUB_PATH
- name: Get latest nimbus-build-system commit hash - name: Get latest nimbus-build-system commit hash
id: versions id: versions

View File

@ -140,6 +140,16 @@ ifeq ($(USE_LIBBACKTRACE), 0)
NIM_PARAMS += -d:disable_libbacktrace NIM_PARAMS += -d:disable_libbacktrace
endif endif
# TODO: port this back to nimbus-build-system
# after we can switch to nim 1.6.16
# This rule override the one in targets.mk
libnatpmp.a: | sanity-checks
ifeq ($(OS), Windows_NT)
+ "$(MAKE)" -C vendor/nim-nat-traversal/vendor/libnatpmp-upstream OS=mingw CC=$(CC) CFLAGS="-Wall -Wno-cpp -Os -DWIN32 -DNATPMP_STATICLIB -DENABLE_STRNATPMPERR -DNATPMP_MAX_RETRIES=4 $(CFLAGS)" $@ $(HANDLE_OUTPUT)
else
+ "$(MAKE)" CFLAGS="-Wall -Wno-cpp -Os -DENABLE_STRNATPMPERR -DNATPMP_MAX_RETRIES=4 $(CFLAGS)" -C vendor/nim-nat-traversal/vendor/libnatpmp-upstream $@ $(HANDLE_OUTPUT)
endif
deps: | deps-common nat-libs nimbus.nims deps: | deps-common nat-libs nimbus.nims
ifneq ($(USE_LIBBACKTRACE), 0) ifneq ($(USE_LIBBACKTRACE), 0)
deps: | libbacktrace deps: | libbacktrace

@ -1 +1 @@
Subproject commit b29c22ba0ef13de50b779c776830dbea1d50cd33 Subproject commit aad5aa227c43a83984245b180c6c295ce9ff561b

@ -1 +1 @@
Subproject commit 27d314d65c9078924b3239fe4e2f5af0c512b28c Subproject commit 14e016503fe6488230e6d0e59396efde96bd9252