16050
|
1 |
name: Tests
|
|
2 |
on:
|
|
3 |
push:
|
|
4 |
branches:
|
|
5 |
- master
|
|
6 |
pull_request:
|
|
7 |
branches:
|
|
8 |
- 'master'
|
|
9 |
- 'stable/**'
|
|
10 |
jobs:
|
|
11 |
|
16067
|
12 |
visual_studio_base:
|
|
13 |
name: Test Visual Studio (base)
|
|
14 |
uses: ./.github/workflows/visual_studio.yaml
|
16050
|
15 |
with:
|
16067
|
16 |
vs_version: "2022"
|
16050
|
17 |
rust: 1.46.0
|
|
18 |
|
16067
|
19 |
visual_studio_stage2:
|
|
20 |
name: Test Visual Studio
|
|
21 |
uses: ./.github/workflows/visual_studio.yaml
|
|
22 |
needs:
|
|
23 |
- visual_studio_base
|
|
24 |
strategy:
|
|
25 |
matrix:
|
|
26 |
vs_version:
|
|
27 |
- "2019"
|
|
28 |
- "2022"
|
|
29 |
arch:
|
|
30 |
- x86_64
|
|
31 |
- i686
|
|
32 |
- aarch64
|
|
33 |
rust:
|
|
34 |
- "1.54.0"
|
|
35 |
include:
|
|
36 |
- arch: x86_64
|
|
37 |
vs_version: 2022
|
|
38 |
rust: stable
|
|
39 |
- arch: x86_64
|
|
40 |
vs_version: 2022
|
|
41 |
rust: nightly
|
|
42 |
with:
|
|
43 |
vs_version: "${{ matrix.vs_version}}"
|
|
44 |
rust: 1.54.0
|
|
45 |
target_arch: "${{ matrix.arch}}"
|
|
46 |
|
|
47 |
windows_ninja_cl:
|
|
48 |
name: Test Windows Ninja MSVC
|
|
49 |
runs-on: ${{ matrix.os }}
|
|
50 |
needs:
|
|
51 |
- visual_studio_base
|
16050
|
52 |
strategy:
|
|
53 |
fail-fast: false
|
|
54 |
matrix:
|
|
55 |
os:
|
16067
|
56 |
- windows-2022
|
16050
|
57 |
arch:
|
|
58 |
- x86_64
|
|
59 |
- i686
|
|
60 |
- aarch64
|
16067
|
61 |
compiler:
|
|
62 |
- cl
|
|
63 |
- clang-cl
|
|
64 |
- clang
|
16050
|
65 |
include:
|
16067
|
66 |
- os: windows-2022
|
|
67 |
vs_version: vs-2022
|
|
68 |
cmake: 3.22.6
|
|
69 |
- rust: 1.54.0
|
|
70 |
# Add variable mapping for ilammy/msvc-dev-cmd action
|
|
71 |
- arch: x86_64
|
|
72 |
msvc_dev_arch: amd64
|
|
73 |
- arch: i686
|
|
74 |
msvc_dev_arch: amd64_x86
|
|
75 |
- arch: aarch64
|
|
76 |
msvc_dev_arch: amd64_arm64
|
16050
|
77 |
exclude:
|
16067
|
78 |
# Not sure what parameters CMake needs when cross-compiling with clang-cl, so exclude for now
|
|
79 |
- compiler: clang-cl
|
16050
|
80 |
arch: i686
|
16067
|
81 |
- compiler: clang-cl
|
16050
|
82 |
arch: aarch64
|
16067
|
83 |
- compiler: clang
|
16050
|
84 |
arch: i686
|
16067
|
85 |
- compiler: clang
|
16050
|
86 |
arch: aarch64
|
|
87 |
|
|
88 |
steps:
|
|
89 |
- uses: actions/checkout@v4
|
16067
|
90 |
- name: Install CMake
|
|
91 |
uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
|
|
92 |
with:
|
|
93 |
cmakeVersion: "${{ matrix.cmake }}"
|
|
94 |
ninjaVersion: "~1.10.0"
|
|
95 |
- name: Install Rust
|
|
96 |
id: install_rust
|
|
97 |
uses: dtolnay/rust-toolchain@master
|
16050
|
98 |
with:
|
16067
|
99 |
toolchain: ${{matrix.rust}}
|
|
100 |
targets: ${{matrix.arch}}-pc-windows-msvc
|
|
101 |
- name: Setup MSVC Development Environment
|
|
102 |
uses: ilammy/msvc-dev-cmd@v1
|
|
103 |
with:
|
|
104 |
arch: ${{ matrix.msvc_dev_arch }}
|
|
105 |
- name: Configure
|
|
106 |
run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "ninja-${{ matrix.arch }}-pc-windows-msvc-${{ matrix.compiler }}"
|
16050
|
107 |
- name: Run Tests
|
|
108 |
working-directory: build
|
|
109 |
run: ctest --output-on-failure --build-config Debug -j 3
|
|
110 |
|
16067
|
111 |
windows_gnu:
|
|
112 |
name: Test Windows GNU
|
|
113 |
runs-on: ${{ matrix.os }}
|
|
114 |
strategy:
|
|
115 |
fail-fast: false
|
|
116 |
matrix:
|
|
117 |
os:
|
|
118 |
- windows-2022
|
|
119 |
arch:
|
|
120 |
- x86_64
|
|
121 |
# - i686
|
|
122 |
# - aarch64
|
|
123 |
compiler:
|
|
124 |
- gcc # Clang only has experimental support for Cygwin / MinGW, so we don't test it
|
|
125 |
generator:
|
|
126 |
- ninja
|
|
127 |
- make
|
|
128 |
include:
|
|
129 |
- cmake: 3.22.6
|
|
130 |
- rust: 1.54.0
|
|
131 |
|
|
132 |
steps:
|
|
133 |
- uses: actions/checkout@v4
|
|
134 |
- name: Install CMake
|
|
135 |
uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
|
|
136 |
with:
|
|
137 |
cmakeVersion: "${{ matrix.cmake }}"
|
|
138 |
ninjaVersion: "~1.10.0"
|
|
139 |
- name: Install Rust
|
|
140 |
id: install_rust
|
|
141 |
uses: dtolnay/rust-toolchain@master
|
|
142 |
with:
|
|
143 |
toolchain: ${{matrix.rust}}
|
|
144 |
targets: ${{matrix.arch}}-pc-windows-gnu
|
|
145 |
- name: Configure
|
|
146 |
run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ matrix.generator }}-${{ matrix.arch }}-pc-windows-gnu-${{ matrix.compiler }}"
|
|
147 |
- name: Run Tests
|
|
148 |
working-directory: build
|
|
149 |
run: ctest --output-on-failure --build-config Debug -j 3
|
|
150 |
|
|
151 |
windows_gnullvm_msys2:
|
|
152 |
name: Test Windows gnullvm on msys2
|
16050
|
153 |
runs-on: ${{ matrix.os }}
|
|
154 |
strategy:
|
|
155 |
fail-fast: false
|
|
156 |
matrix:
|
|
157 |
os:
|
|
158 |
- windows-2022
|
|
159 |
arch:
|
|
160 |
- x86_64
|
16067
|
161 |
# - i686
|
|
162 |
# - aarch64
|
|
163 |
generator:
|
|
164 |
- Ninja
|
|
165 |
- MSYS Makefiles
|
|
166 |
include:
|
|
167 |
- arch: x86_64
|
|
168 |
msystem: CLANG64
|
|
169 |
# - arch: i686
|
|
170 |
# msystem: CLANG32
|
|
171 |
# - arch: aarch64
|
|
172 |
# msystem: CLANGARM64
|
|
173 |
defaults:
|
|
174 |
run:
|
|
175 |
shell: msys2 {0}
|
|
176 |
steps:
|
|
177 |
- uses: actions/checkout@v4
|
|
178 |
- name: Install Rust
|
|
179 |
id: install_rust
|
|
180 |
uses: dtolnay/rust-toolchain@master
|
|
181 |
with:
|
|
182 |
toolchain: stable
|
|
183 |
targets: ${{matrix.arch}}-pc-windows-gnullvm
|
|
184 |
- uses: msys2/setup-msys2@v2
|
|
185 |
with:
|
|
186 |
msystem: ${{matrix.msystem}}
|
|
187 |
path-type: inherit
|
|
188 |
install: >-
|
|
189 |
git
|
|
190 |
make
|
|
191 |
pacboy: >-
|
|
192 |
toolchain:p
|
|
193 |
cmake:p
|
|
194 |
ninja:p
|
|
195 |
- name: Configure
|
|
196 |
run: cmake -S. -Bbuild -G "${{matrix.generator}}" --toolchain=.github/scripts/toolchains/${{matrix.arch}}-pc-windows-gnullvm.cmake
|
|
197 |
- name: Run Tests
|
|
198 |
working-directory: build
|
|
199 |
run: ctest --output-on-failure --build-config Debug -j 3
|
|
200 |
|
|
201 |
# For now just test if hostbuild works when cross-compiling on windows.
|
|
202 |
# For testing everything we would also need to install a cross-compiler first.
|
|
203 |
windows_cross_hostbuild:
|
|
204 |
name: Test Windows Cross
|
|
205 |
runs-on: windows-2022
|
|
206 |
steps:
|
|
207 |
- uses: actions/checkout@v4
|
|
208 |
- name: Install CMake
|
|
209 |
uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
|
|
210 |
with:
|
|
211 |
cmakeVersion: "~3.22.0"
|
|
212 |
ninjaVersion: "~1.10.0"
|
|
213 |
- name: Install Rust
|
|
214 |
id: install_rust
|
|
215 |
uses: dtolnay/rust-toolchain@master
|
|
216 |
with:
|
|
217 |
toolchain: stable
|
|
218 |
targets: aarch64-unknown-linux-gnu
|
|
219 |
- name: Configure
|
|
220 |
run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" -DRust_CARGO_TARGET=aarch64-unknown-linux-gnu
|
|
221 |
- name: Run Tests
|
|
222 |
working-directory: build
|
|
223 |
run: ctest --output-on-failure --build-config Debug -R hostbuild
|
|
224 |
|
|
225 |
linux_base:
|
|
226 |
name: Test Linux (base)
|
|
227 |
uses: ./.github/workflows/linux.yaml
|
|
228 |
with:
|
|
229 |
c_compiler: "gcc"
|
|
230 |
generator: "Ninja"
|
|
231 |
|
|
232 |
linux_stage2:
|
|
233 |
name: Test Linux
|
|
234 |
needs:
|
|
235 |
- linux_base
|
|
236 |
uses: ./.github/workflows/linux.yaml
|
|
237 |
with:
|
|
238 |
target_arch: "${{ matrix.arch }}"
|
|
239 |
c_compiler: "${{ matrix.compiler }}"
|
|
240 |
generator: "${{ matrix.generator }}"
|
|
241 |
strategy:
|
|
242 |
fail-fast: false
|
|
243 |
matrix:
|
|
244 |
arch:
|
|
245 |
- x86_64
|
16050
|
246 |
- i686
|
|
247 |
- aarch64
|
16067
|
248 |
compiler:
|
|
249 |
- gcc
|
|
250 |
generator:
|
|
251 |
- "Ninja"
|
|
252 |
- "Unix Makefiles"
|
16050
|
253 |
include:
|
16067
|
254 |
# rustc doesn't support cross-compiling with clang out of the box, since
|
|
255 |
# clang requires a --target parameter. Corrosion currently can only pass
|
|
256 |
# this for the top-level crate, so linking of cdylibs that are built as
|
|
257 |
# dependencies of this crate will fail if they exist.
|
|
258 |
# Solutions would be to make cross-compiling with clang work out-of-the-box
|
|
259 |
# in rustc, or working around it in corrosion by adding a linker-wrapper.
|
|
260 |
# For this reason we only test clang with the host target for now.
|
|
261 |
- arch: x86_64
|
|
262 |
compiler: clang
|
|
263 |
generator: "Ninja"
|
16050
|
264 |
- arch: x86_64
|
16067
|
265 |
generator: "Ninja Multi-Config"
|
|
266 |
compiler: gcc
|
|
267 |
|
|
268 |
darwin:
|
|
269 |
name: Test MacOS
|
|
270 |
runs-on: ${{ matrix.os }}
|
|
271 |
strategy:
|
|
272 |
fail-fast: false
|
|
273 |
matrix:
|
|
274 |
arch:
|
|
275 |
- x86_64
|
|
276 |
- aarch64
|
|
277 |
compiler:
|
|
278 |
- clang
|
|
279 |
generator:
|
|
280 |
- "Ninja"
|
|
281 |
- "Xcode"
|
|
282 |
include:
|
|
283 |
- os: macos-latest
|
|
284 |
- cmake: 3.22.6
|
|
285 |
- rust: 1.54.0
|
16050
|
286 |
|
|
287 |
steps:
|
|
288 |
- uses: actions/checkout@v4
|
16067
|
289 |
- name: Install CMake
|
|
290 |
uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
|
16050
|
291 |
with:
|
16067
|
292 |
cmakeVersion: "${{ matrix.cmake }}"
|
|
293 |
ninjaVersion: "~1.10.0"
|
|
294 |
# Install cbindgen before Rust to use recent default Rust version.
|
|
295 |
- name: Install cbindgen
|
|
296 |
run: cargo install cbindgen
|
|
297 |
- name: Install Rust
|
|
298 |
id: install_rust
|
|
299 |
uses: dtolnay/rust-toolchain@master
|
16050
|
300 |
with:
|
16067
|
301 |
toolchain: ${{matrix.rust}}
|
|
302 |
targets: ${{matrix.arch}}-apple-darwin
|
|
303 |
- name: Configure
|
|
304 |
run: cmake -S. -Bbuild --log-level=DEBUG -G "${{ matrix.generator }}" "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ matrix.arch }}-apple-darwin-${{ matrix.compiler }}"
|
16050
|
305 |
- name: Run Tests
|
|
306 |
working-directory: build
|
|
307 |
run: ctest --output-on-failure --build-config Debug -j 3
|
|
308 |
|
16067
|
309 |
|
16050
|
310 |
test_cxxbridge:
|
|
311 |
name: Test cxxbridge integration
|
|
312 |
runs-on: ${{ matrix.os }}
|
|
313 |
strategy:
|
|
314 |
fail-fast: false
|
|
315 |
matrix:
|
|
316 |
os:
|
16067
|
317 |
- windows-2022
|
16050
|
318 |
- ubuntu-latest
|
16067
|
319 |
- macos-13
|
16050
|
320 |
include:
|
16067
|
321 |
# Should be in sync with the `cxx` version the Carg.lock of the cxxbridge tests,
|
|
322 |
# otherwise the caching will not work and the cmd will be built from source.
|
|
323 |
- cxxbridge_version: "1.0.86"
|
16050
|
324 |
steps:
|
|
325 |
- uses: actions/checkout@v4
|
|
326 |
- uses: actions/cache@v4
|
|
327 |
id: cache_cxxbridge
|
|
328 |
with:
|
|
329 |
path: "~/.cargo/bin/cxxbridge*"
|
16067
|
330 |
key: ${{ runner.os }}-cxxbridge_${{ matrix.cxxbridge_version }}
|
16050
|
331 |
- name: Install cxxbridge
|
|
332 |
if: steps.cache_cxxbridge.outputs.cache-hit != 'true'
|
16067
|
333 |
run: cargo install cxxbridge-cmd@${{ matrix.cxxbridge_version }}
|
16050
|
334 |
- name: Install lld
|
|
335 |
run: sudo apt update && sudo apt install -y lld
|
|
336 |
if: ${{ 'Linux' == runner.os }}
|
16067
|
337 |
- name: Setup MSVC Development Environment
|
|
338 |
uses: ilammy/msvc-dev-cmd@v1
|
|
339 |
if: runner.os == 'Windows'
|
|
340 |
- name: Install CMake
|
|
341 |
uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
|
16050
|
342 |
with:
|
16067
|
343 |
cmakeVersion: "~3.22.0"
|
|
344 |
ninjaVersion: "~1.10.0"
|
|
345 |
- name: Install Rust
|
|
346 |
uses: dtolnay/rust-toolchain@master
|
|
347 |
with:
|
|
348 |
toolchain: stable minus 2 releases
|
|
349 |
- name: Configure
|
|
350 |
run: >
|
|
351 |
cmake
|
|
352 |
-S.
|
|
353 |
-Bbuild
|
|
354 |
-GNinja
|
|
355 |
-DCORROSION_VERBOSE_OUTPUT=ON
|
|
356 |
-DCORROSION_TESTS_CXXBRIDGE=ON
|
16050
|
357 |
- name: Run Tests
|
|
358 |
working-directory: build
|
|
359 |
run: ctest --output-on-failure --build-config Debug -j 3 -R "^cxxbridge"
|
16067
|
360 |
|
|
361 |
autoinstall_cargo_target:
|
|
362 |
name: Test Auto-installing Cargo target via rustup
|
|
363 |
runs-on: ubuntu-22.04
|
|
364 |
steps:
|
|
365 |
- uses: actions/checkout@v4
|
|
366 |
- name: Install CMake
|
|
367 |
uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
|
|
368 |
- name: Install Rust
|
|
369 |
id: install_rust
|
|
370 |
uses: dtolnay/rust-toolchain@stable
|
|
371 |
- name: Install Cross Compiler
|
|
372 |
shell: bash
|
|
373 |
run: |
|
|
374 |
echo "::group::apt-install"
|
|
375 |
sudo apt-get update
|
|
376 |
sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
377 |
echo "::endgroup::"
|
|
378 |
- name: Assert rustup target is not installed
|
|
379 |
run: rustup show | ( ! grep aarch64)
|
|
380 |
- name: Configure Corrosion
|
|
381 |
run: cmake -S. -Bbuild -GNinja -DRust_RUSTUP_INSTALL_MISSING_TARGET=ON --preset "aarch64-unknown-linux-gnu-gcc"
|
|
382 |
- name: Check rustup target is installed after configuring
|
|
383 |
run: rustup show | grep aarch64
|
|
384 |
|
16050
|
385 |
install:
|
|
386 |
name: Test Corrosion as a Library
|
|
387 |
runs-on: ${{ matrix.os }}
|
|
388 |
strategy:
|
|
389 |
fail-fast: false
|
|
390 |
matrix:
|
|
391 |
os:
|
16067
|
392 |
- windows-2022
|
16050
|
393 |
- ubuntu-latest
|
16067
|
394 |
- macos-13
|
16050
|
395 |
include:
|
16067
|
396 |
- rust: 1.54.0
|
|
397 |
|
16050
|
398 |
steps:
|
|
399 |
- uses: actions/checkout@v4
|
|
400 |
- name: Setup MSVC Development Environment
|
|
401 |
uses: ilammy/msvc-dev-cmd@v1
|
|
402 |
if: runner.os == 'Windows'
|
|
403 |
- name: Install CMake
|
|
404 |
uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
|
|
405 |
with:
|
16067
|
406 |
cmakeVersion: "~3.22.0"
|
16050
|
407 |
ninjaVersion: "~1.10.0"
|
16067
|
408 |
# Install cbindgen before Rust to use recent default Rust version.
|
|
409 |
- name: Install cbindgen
|
|
410 |
run: cargo install cbindgen
|
16050
|
411 |
- name: Install Rust
|
|
412 |
uses: dtolnay/rust-toolchain@master
|
|
413 |
with:
|
|
414 |
toolchain: ${{matrix.rust}}
|
|
415 |
- name: Test Corrosion as installed module
|
|
416 |
run: >
|
|
417 |
cmake
|
|
418 |
-S.
|
|
419 |
-Bbuild
|
|
420 |
-GNinja
|
|
421 |
-DCORROSION_VERBOSE_OUTPUT=ON
|
|
422 |
-DCMAKE_BUILD_TYPE=Release
|
|
423 |
-DCORROSION_TESTS_INSTALL_CORROSION=ON
|
|
424 |
&&
|
|
425 |
cd build
|
|
426 |
&&
|
|
427 |
ctest --output-on-failure -C Release -j 3
|
16067
|
428 |
|
|
429 |
# We want an "accumulation" job here because it is easier to specify required
|
|
430 |
# jobs here via needs, then in the github UI, since we use matrix jobs.
|
16050
|
431 |
ci-success:
|
|
432 |
name: bors-ci-status
|
|
433 |
if: ${{ always() }}
|
|
434 |
needs:
|
16067
|
435 |
- visual_studio_stage2
|
|
436 |
- windows_ninja_cl
|
|
437 |
- windows_gnu
|
|
438 |
- windows_gnullvm_msys2
|
|
439 |
- linux_stage2
|
|
440 |
- darwin
|
16050
|
441 |
- test_cxxbridge
|
16067
|
442 |
- autoinstall_cargo_target
|
16050
|
443 |
- install
|
|
444 |
runs-on: ubuntu-latest
|
|
445 |
# Step copied from: https://github.com/cross-rs/cross/blob/80c9f9109a719ffb0f694060ddc6e371d5b3a540/.github/workflows/ci.yml#L361
|
|
446 |
steps:
|
|
447 |
- name: Result
|
|
448 |
run: |
|
|
449 |
jq -C <<< "${needs}"
|
|
450 |
# Check if all needs were successful or skipped.
|
|
451 |
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
|
|
452 |
env:
|
|
453 |
needs: ${{ toJson(needs) }}
|
|
454 |
|