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

Add cross compilation tests #1808

Merged
merged 2 commits into from
Jun 9, 2022
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
54 changes: 54 additions & 0 deletions .github/workflows/cross-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test (cross-compilation)

on:
pull_request:
push:
branches:
- master

env:
RUSTFLAGS: -Dwarnings

jobs:
test:
name: Test
strategy:
matrix:
#
# i686 cross compilation requires mingw packages that are configured
# to use DWARF-2 exception handling (vice SJLJ).
#
# The mingw package ecosystem is fragmented so we avoid that target
# for now. (e.g. macOS hosts will require mingw recompile)
#
# See also:
# https://github.com/rust-lang/rust/issues/79577
# https://sourceforge.net/p/mingw-w64/wiki2/Exception%20Handling/
#
image: [macos-latest, ubuntu-latest]
version: [stable, nightly]
target: [x86_64-pc-windows-gnu]
runs-on: ${{ matrix.image }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Add toolchain target
run: rustup target add ${{ matrix.target }}

- name: Install gcc-mingw-w64-x86-64
run: sudo apt-get install -y gcc-mingw-w64-x86-64
if: startsWith(matrix.image, 'ubuntu-') && matrix.target == 'x86_64-pc-windows-gnu'

- name: Install mingw-w64
run: brew install mingw-w64
if: startsWith(matrix.image, 'macos-') && matrix.target == 'x86_64-pc-windows-gnu'

- name: Test
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."
}