Skip to content

Commit 66b8fff

Browse files
committed
Test Windows cross-compilation on CI
1 parent d23b12f commit 66b8fff

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/main.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
os: [ubuntu-latest, macos-latest]
14+
include:
15+
- os: ubuntu-latest
16+
- os: macos-latest
17+
# cross-compile from Linux to Windows using mingw
18+
- os: ubuntu-latest
19+
env:
20+
TARGET_TRIPLE: x86_64-pc-windows-gnu
1521

1622
steps:
1723
- uses: actions/checkout@v2
@@ -36,13 +42,21 @@ jobs:
3642
path: target
3743
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
3844

45+
- name: Install MinGW toolchain and wine
46+
if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
47+
run: |
48+
sudo apt install gcc-mingw-w64-x86-64 wine-stable
49+
rustup target add x86_64-pc-windows-gnu
50+
3951
- name: Prepare dependencies
4052
run: |
4153
git config --global user.email "[email protected]"
4254
git config --global user.name "User"
4355
./prepare.sh
4456
4557
- name: Test
58+
env:
59+
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
4660
run: |
4761
# Enable backtraces for easier debugging
4862
export RUST_BACKTRACE=1
@@ -57,6 +71,7 @@ jobs:
5771
run: tar cvfJ cg_clif.tar.xz build
5872

5973
- name: Upload prebuilt cg_clif
74+
if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
6075
uses: actions/upload-artifact@v2
6176
with:
6277
name: cg_clif-${{ runner.os }}

prepare.sh

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
set -e
33

44
rustup component add rust-src rustc-dev llvm-tools-preview
5-
rustup target add x86_64-pc-windows-gnu
65
./build_sysroot/prepare_sysroot_src.sh
76
cargo install hyperfine || echo "Skipping hyperfine install"
87

0 commit comments

Comments
 (0)