-
-
Notifications
You must be signed in to change notification settings - Fork 108
342 lines (325 loc) · 9.45 KB
/
test.yaml
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- 'master'
- 'stable/**'
jobs:
visual_studio_base:
name: Test Visual Studio (base)
uses: ./.github/workflows/visual_studio.yaml
with:
vs_version: "2022"
rust: 1.46.0
visual_studio_stage2:
name: Test Visual Studio
uses: ./.github/workflows/visual_studio.yaml
needs:
- visual_studio_base
strategy:
matrix:
vs_version:
- "2019"
- "2022"
arch:
- x86_64
- i686
- aarch64
rust:
- "1.54.0"
include:
- arch: x86_64
vs_version: 2022
rust: stable
- arch: x86_64
vs_version: 2022
rust: nightly
with:
vs_version: "${{ matrix.vs_version}}"
rust: 1.54.0
target_arch: "${{ matrix.arch}}"
windows_ninja_cl:
name: Test Windows Ninja MSVC
runs-on: ${{ matrix.os }}
needs:
- visual_studio_base
strategy:
fail-fast: false
matrix:
os:
- windows-2022
arch:
- x86_64
- i686
- aarch64
compiler:
- cl
- clang-cl
include:
- os: windows-2022
vs_version: vs-2022
cmake: 3.22.6
- rust: 1.54.0
# Add variable mapping for ilammy/msvc-dev-cmd action
- arch: x86_64
msvc_dev_arch: amd64
- arch: i686
msvc_dev_arch: amd64_x86
- arch: aarch64
msvc_dev_arch: amd64_arm64
exclude:
# Not sure what parameters CMake needs when cross-compiling with clang-cl, so exclude for now
- compiler: clang-cl
arch: i686
- compiler: clang-cl
arch: aarch64
steps:
- uses: actions/checkout@v4
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: ${{ matrix.cmake }}
ninja: 1.10.0
- name: Install Rust
id: install_rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
targets: ${{matrix.arch}}-pc-windows-msvc
- name: Setup MSVC Development Environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.msvc_dev_arch }}
- name: New configure
run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "ninja-${{ matrix.arch }}-pc-windows-msvc-${{ matrix.compiler }}"
- name: Run Tests
working-directory: build
run: ctest --output-on-failure --build-config Debug -j 3
windows_gnu:
name: Test Windows GNU
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-2022
arch:
- x86_64
# - i686
# - aarch64
compiler:
- gcc # Clang only has experimental support for Cygwin / MinGW, so we don't test it
generator:
- ninja
- make
include:
- cmake: 3.22.6
- rust: 1.54.0
steps:
- uses: actions/checkout@v4
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: ${{ matrix.cmake }}
ninja: 1.10.0
- name: Install Rust
id: install_rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
targets: ${{matrix.arch}}-pc-windows-gnu
- name: New configure
run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ matrix.generator }}-${{ matrix.arch }}-pc-windows-gnu-${{ matrix.compiler }}"
- name: Run Tests
working-directory: build
run: ctest --output-on-failure --build-config Debug -j 3
linux_base:
name: Test Linux (base)
uses: ./.github/workflows/linux.yaml
with:
c_compiler: "gcc"
generator: "Ninja"
linux_stage_2:
name: Test Linux
needs:
- linux_base
uses: ./.github/workflows/linux.yaml
with:
target_arch: "${{ matrix.arch }}"
c_compiler: "${{ matrix.compiler }}"
generator: "${{ matrix.generator }}"
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- i686
- aarch64
compiler:
- gcc
generator:
- "Ninja"
- "Unix Makefiles"
include:
# rustc doesn't support cross-compiling with clang out of the box, since
# clang requires a --target parameter. Corrosion currently can only pass
# this for the top-level crate, so linking of cdylibs that are built as
# dependencies of this crate will fail if they exist.
# Solutions would be to make cross-compiling with clang work out-of-the-box
# in rustc, or working around it in corrosion by adding a linker-wrapper.
# For this reason we only test clang with the host target for now.
- arch: x86_64
compiler: clang
generator: "Ninja"
- arch: x86_64
generator: "Ninja Multi-Config"
compiler: gcc
darwin:
name: Test MacOS
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
arch:
- x86_64
# - aarch64
compiler:
- clang
generator:
- "Ninja"
- "Xcode"
include:
- os: macos-latest
- cmake: 3.22.6
- rust: 1.54.0
steps:
- uses: actions/checkout@v4
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: ${{ matrix.cmake }}
ninja: 1.10.0
- name: Install Rust
id: install_rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
targets: ${{matrix.arch}}-apple-darwin
- name: New configure
run: cmake -S. -Bbuild -G "${{ matrix.generator }}" "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ matrix.arch }}-apple-darwin-${{ matrix.compiler }}"
- name: Run Tests
working-directory: build
run: ctest --output-on-failure --build-config Debug -j 3
test_cxxbridge:
name: Test cxxbridge integration
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-2022
- ubuntu-latest
- macos-13
include:
- cxxbridge_version: "1.0.86"
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
id: cache_cxxbridge
with:
path: "~/.cargo/bin/cxxbridge*"
key: ${{ runner.os }}-cxxbridge_1_0_86
- name: Install cxxbridge
if: steps.cache_cxxbridge.outputs.cache-hit != 'true'
run: cargo install [email protected]
- name: Install lld
run: sudo apt update && sudo apt install -y lld
if: ${{ 'Linux' == runner.os }}
- name: Setup MSVC Development Environment
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: 3.22.6
ninja: 1.10.0
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable minus 2 releases
- name: Configure
run: >
cmake
-S.
-Bbuild
-GNinja
-DCORROSION_VERBOSE_OUTPUT=ON
-DDCORROSION_TESTS_CXXBRIDGE=ON
- name: Run Tests
working-directory: build
run: ctest --output-on-failure --build-config Debug -j 3 -R "^cxxbridge"
install:
name: Test Corrosion as a Library
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-2022
- ubuntu-latest
- macos-13
include:
- rust: 1.54.0
steps:
- uses: actions/checkout@v4
- name: Setup MSVC Development Environment
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: 3.22.6
ninja: 1.10.0
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- name: Test Corrosion as installed module
run: >
cmake
-S.
-Bbuild
-GNinja
-DCORROSION_VERBOSE_OUTPUT=ON
-DCMAKE_BUILD_TYPE=Release
-DCORROSION_TESTS_INSTALL_CORROSION=ON
&&
cd build
&&
ctest --output-on-failure -C Release -j 3
# We want an "accumulation" job here because it is easier to specify required
# jobs here via needs, then in the github UI, since we use matrix jobs.
ci-success:
name: bors-ci-status
if: ${{ always() }}
needs:
- visual_studio_stage2
- windows_ninja_cl
- windows_gnu
- linux_stage2
- darwin
- test_cxxbridge
- install
runs-on: ubuntu-latest
# Step copied from: https://github.com/cross-rs/cross/blob/80c9f9109a719ffb0f694060ddc6e371d5b3a540/.github/workflows/ci.yml#L361
steps:
- name: Result
run: |
jq -C <<< "${needs}"
# Check if all needs were successful or skipped.
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
env:
needs: ${{ toJson(needs) }}