Skip to content

Commit

Permalink
Test cross-compilation with stable gnullvm targets (#3104)
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 authored Jun 20, 2024
1 parent bfb55f3 commit 2ec4e06
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,18 @@ 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 }}

steps:
- 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
Expand All @@ -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'

0 comments on commit 2ec4e06

Please sign in to comment.