From 2ec4e06d366c46ba9634316959f680ea3dc42a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Thu, 20 Jun 2024 22:02:01 +0200 Subject: [PATCH] Test cross-compilation with stable gnullvm targets (#3104) --- .github/workflows/cross.yml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml index 3751348368..7c44bcdb99 100644 --- a/.github/workflows/cross.yml +++ b/.github/workflows/cross.yml @@ -28,7 +28,6 @@ jobs: # https://sourceforge.net/p/mingw-w64/wiki2/Exception%20Handling # image: [macos-latest, ubuntu-latest] - version: [stable, nightly] target: [x86_64-pc-windows-gnu, aarch64-pc-windows-gnullvm, x86_64-pc-windows-gnullvm, i686-pc-windows-gnullvm] runs-on: ${{ matrix.image }} @@ -36,15 +35,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Update toolchain + run: rustup update --no-self-update stable && rustup default stable + - name: Add toolchain target run: rustup target add ${{ matrix.target }} - if: contains(matrix.target, 'gnullvm') == false - - - name: Add nightly toolchain with gnullvm target - run: | - rustup default ${{ matrix.version }} - rustup target add ${{ matrix.target }} - if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') && matrix.version == 'nightly' - name: Install gcc-mingw-w64-x86-64 run: sudo apt-get install -y gcc-mingw-w64-x86-64 @@ -57,37 +52,28 @@ jobs: - name: LLVM MinGW toolchain cache configuration id: cache-llvm-mingw-toolchain uses: actions/cache@v4 - if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') && matrix.version == 'nightly' + if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') with: path: ${{ env.LLVM-MINGW-TOOLCHAIN-NAME }} key: ${{ env.LLVM-MINGW-TOOLCHAIN-NAME }} - name: Install LLVM MinGW toolchain - if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') && matrix.version == 'nightly' && steps.cache-llvm-mingw-toolchain.outputs.cache-hit != 'true' + if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') && steps.cache-llvm-mingw-toolchain.outputs.cache-hit != 'true' run: | curl -L -o ${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}.tar.xz https://github.com/mstorsjo/llvm-mingw/releases/download/20220906/${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}.tar.xz tar -xf ${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}.tar.xz echo "${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}/bin" >> $GITHUB_PATH - name: Add LLVM MinGW toolchain to PATH - if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') && matrix.version == 'nightly' + if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') run: | echo "${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}/bin" >> $GITHUB_PATH - name: Test shell: pwsh + if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') || endsWith(matrix.target, 'gnu') run: | cargo test --no-run --target ${{ matrix.target }} -p test_win32 if (-Not (Resolve-Path "target/*/debug/deps/test_win32-*.exe" | Test-Path)) { throw "Failed to find test_win32 executable." } - if: contains(matrix.target, 'gnullvm') == false - - - name: Test gnullvm - shell: pwsh - run: | - cargo test --no-run --target ${{ matrix.target }} -p test_win32 - if (-Not (Resolve-Path "target/*/debug/deps/test_win32-*.exe" | Test-Path)) { - throw "Failed to find test_win32 executable." - } - if: startsWith(matrix.image, 'ubuntu-') && contains(matrix.target, 'gnullvm') && matrix.version == 'nightly'