Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test cross-compilation with stable gnullvm targets #3104

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'