From 342c7a786b2a150315ee89a09abd1d53135f2fbe Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 12 Sep 2023 19:52:29 +0700 Subject: [PATCH] Switch to llvm-mingw on Windows CI for faster runtime --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c96a8e8..2f1e034 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,19 +27,16 @@ jobs: - target: os: linux builder: ubuntu-20.04 - shell: bash - target: os: macos builder: macos-12 - shell: bash - target: os: windows builder: windows-latest - shell: msys2 {0} defaults: run: - shell: ${{ matrix.shell }} + shell: bash name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})' runs-on: ${{ matrix.builder }} @@ -74,26 +71,31 @@ jobs: chmod 755 external/bin/gcc external/bin/g++ echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH - - name: MSYS2 (Windows i386) - if: runner.os == 'Windows' && matrix.target.cpu == 'i386' - 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 - msystem: MINGW32 - install: >- - base-devel - git - mingw-w64-i686-toolchain + path: external/mingw-${{ matrix.target.cpu }} + key: 'mingw-llvm-17-${{ matrix.target.cpu }}' - - 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: 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: Restore Nim DLLs dependencies (Windows) from cache if: runner.os == 'Windows' @@ -108,7 +110,7 @@ jobs: steps.windows-dlls-cache.outputs.cache-hit != 'true' && runner.os == 'Windows' run: | - mkdir external + mkdir -p external curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip 7z x external/windeps.zip -oexternal/dlls @@ -116,6 +118,7 @@ jobs: if: > runner.os == 'Windows' run: | + echo '${{ github.workspace }}'"/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH echo '${{ github.workspace }}'"/external/dlls" >> $GITHUB_PATH - name: Derive environment variables @@ -165,3 +168,6 @@ jobs: env TEST_LANG="c" nimble test # run test against intx env TEST_LANG="cpp" nimble test + # test conditional compilation for arm654 arch + # without running the binary + nim c -c --cpu:arm64 --os:linux tests/all_tests