-
Notifications
You must be signed in to change notification settings - Fork 493
94 lines (81 loc) · 3.66 KB
/
cross.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: cross
on:
pull_request:
push:
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
branches:
- master
env:
RUSTFLAGS: -Dwarnings
LLVM-MINGW-TOOLCHAIN-NAME: llvm-mingw-20220906-ucrt-ubuntu-18.04-x86_64
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, aarch64-pc-windows-gnullvm, x86_64-pc-windows-gnullvm]
runs-on: ${{ matrix.image }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add toolchain target
run: rustup target add ${{ matrix.target }}
if: contains(matrix.target, 'gnullvm') == false
- name: Add nightly toolchain with rust-src
run: |
rustup default ${{ matrix.version }}
rustup component add rust-src
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
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: 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'
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'
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'
run: |
echo "${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}/bin" >> $GITHUB_PATH
- 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."
}
if: contains(matrix.target, 'gnullvm') == false
- name: Test with build-std
shell: pwsh
run: |
cargo test --no-run --target ${{ matrix.target }} -Z build-std -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'