-
Notifications
You must be signed in to change notification settings - Fork 37
239 lines (228 loc) · 7.88 KB
/
test.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Build & Test
on: [push, pull_request]
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
windows-msvc:
strategy:
fail-fast: false
matrix:
toolchain: [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc]
channel: [1.48.0, stable, beta, nightly]
runs-on: windows-latest
name: Windows - ${{ matrix.target }} - ${{ matrix.channel }}
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}-${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
profile: minimal
default: true
- name: Test libffi-sys-rs
run: |
cd libffi-sys-rs
cargo test
- name: Test libffi-rs
run: |
cd libffi-rs
cargo test
windows-gnu:
strategy:
fail-fast: false
matrix:
channel: [1.48.0, stable, beta, nightly]
runs-on: windows-latest
name: Windows - x86_64-pc-windows-gnu - ${{ matrix.channel }}
env:
RUST_BACKTRACE: 1
steps:
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
release: false
path-type: inherit
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}-x86_64-pc-windows-gnu
target: x86_64-pc-windows-gnu
override: true
profile: minimal
default: true
- name: Test libffi-sys-rs
shell: msys2 {0}
run: |
cd libffi-sys-rs
cargo test
- name: Test libffi-rs
shell: msys2 {0}
run: |
cd libffi-rs
cargo test
macos:
strategy:
fail-fast: false
matrix:
# rust < 1.54 does not work on macos >= 12:
# https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20How.20can.20I.20fix.20Rust.201.2E53.2E0.20or.20earlier.20to.20run.20on.20macOS.2012.2E6.3F/near/299263887
# channel: [1.48.0, stable, beta, nightly]
channel: [stable, beta, nightly]
features: ["--no-default-features", "--features system"]
runs-on: macos-latest
name: macOS - ${{ matrix.channel }} ${{ matrix.features }}
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: brew install autoconf automake libtool libffi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}-x86_64-apple-darwin
target: x86_64-apple-darwin
override: true
profile: minimal
default: true
- name: Test libffi-sys-rs
run: |
cd libffi-sys-rs
cargo test ${{ matrix.features }}
- name: Test libffi-rs
run: |
cd libffi-rs
cargo test ${{ matrix.features }}
linux:
strategy:
fail-fast: false
matrix:
channel: [1.48.0, stable, beta, nightly]
features: ["--no-default-features", "--features system"]
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
exclude:
# Don't try to build with `--features system` when cross-compiling
# It's probably possible to make this work for some of these architectures
# (e.g. I got it working on my Ubuntu image for i686), but it complicates
# testing a bit
- target: i686-unknown-linux-gnu
features: "--features system"
- target: aarch64-unknown-linux-gnu
features: "--features system"
- target: armv7-unknown-linux-gnueabihf
features: "--features system"
- target: riscv64gc-unknown-linux-gnu
features: "--features system"
- target: s390x-unknown-linux-gnu
features: "--features system"
# 1.48.0 is too old for riscv64gc-unknown-linux-gnu
- target: riscv64gc-unknown-linux-gnu
channel: 1.48.0
runs-on: ubuntu-latest
name: Linux - ${{ matrix.channel }} ${{ matrix.features }} ${{ matrix.target }}
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}
target: ${{ matrix.target }}
override: true
profile: minimal
default: true
- name: Set-up Cross Compiling
id: arch_attrs
run: |
# Get unique attributes for each architecture
if [ "${{ matrix.target }}" == "i686-unknown-linux-gnu" ]; then
GCC_ARCH=i686
ABI=gnu
elif [ "${{ matrix.target }}" == "powerpc64-unknown-linux-gnu" ]; then
GCC_ARCH=powerpc64
QEMU_ARCH=ppc64
ABI=gnu
elif [ "${{ matrix.target }}" == "powerpc64le-unknown-linux-gnu" ]; then
GCC_ARCH=powerpc64le
QEMU_ARCH=ppc64le
ABI=gnu
elif [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then
GCC_ARCH=aarch64
QEMU_ARCH=aarch64
ABI=gnu
elif [ "${{ matrix.target }}" == "armv7-unknown-linux-gnueabihf" ]; then
GCC_ARCH=arm
QEMU_ARCH=arm
ABI=gnueabihf
elif [ "${{ matrix.target }}" == "riscv64gc-unknown-linux-gnu" ]; then
GCC_ARCH=riscv64
QEMU_ARCH=riscv64
ABI=gnu
elif [ "${{ matrix.target }}" == "s390x-unknown-linux-gnu" ]; then
GCC_ARCH=s390x
QEMU_ARCH=s390x
ABI=gnu
fi
# Install cross-compiler
sudo apt-get update
sudo apt-get install -y \
gcc-9-$(echo $GCC_ARCH | tr _ -)-linux-$ABI
# Convert target triple to uppercase and replace - with _
TARGET_TRIPLE=$(echo "${{ matrix.target }}" | tr - _)
TARGET_TRIPLE=${TARGET_TRIPLE^^}
CC=$GCC_ARCH-linux-$ABI-gcc-9
# Set cross-compiler as CC and set cargo target runner as qemu
echo "CC=$CC" >> $GITHUB_ENV
echo "CARGO_TARGET_${TARGET_TRIPLE}_LINKER=$CC" >> $GITHUB_ENV
# Don't need QEMU for i686
if [ "$QEMU_ARCH" != "" ]; then
sudo apt-get install -y qemu-user
echo "CARGO_TARGET_${TARGET_TRIPLE}_RUNNER=qemu-$QEMU_ARCH -L /usr/$GCC_ARCH-linux-$ABI/" >> $GITHUB_ENV
fi
if: ${{ 'x86_64-unknown-linux-gnu' != matrix.target }}
- name: Test libffi-sys-rs
run: |
cd libffi-sys-rs
cargo test --target ${{ matrix.target }} ${{ matrix.features }}
- name: Test libffi-rs
run: |
cd libffi-rs
cargo test --target ${{ matrix.target }} ${{ matrix.features }}