Skip to content

Commit c1cf039

Browse files
committed
ci: set the CARGO_BUILD_TARGET to reuse same cache
Corrosion sets the --target flag to rustc which means that crates are built in the target sub folder. Ensure that other places that call cargo directly reuse this same folder by setting CARGO_BUILD_TARGET.
1 parent 9dfd0d4 commit c1cf039

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/github-cxx-qt-tests.yml

+9
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ jobs:
269269
clang_format_path: /home/runner/.local/bin/clang-format
270270
cargo_dir: ~/.cargo
271271
rustc_wrapper: sccache
272+
cargo_target: x86_64-unknown-linux-gnu
272273
- name: Ubuntu 24.04 (gcc) Qt6
273274
os: ubuntu-24.04
274275
qt_version: 6
@@ -289,6 +290,7 @@ jobs:
289290
libgl1-mesa-dev
290291
libvulkan-dev
291292
libxkbcommon-dev
293+
cargo_target: x86_64-unknown-linux-gnu
292294

293295
- name: macOS 13 (clang) Qt5
294296
os: macos-13
@@ -311,6 +313,7 @@ jobs:
311313
cc: clang
312314
cxx: clang++
313315
rustc_wrapper: sccache
316+
cargo_target: x86_64-apple-darwin
314317
- name: macOS 14 (clang) Qt6
315318
os: macos-14
316319
qt_version: 6
@@ -332,6 +335,7 @@ jobs:
332335
cc: clang
333336
cxx: clang++
334337
rustc_wrapper: sccache
338+
cargo_target: aarch64-apple-darwin
335339

336340
- name: Windows 2022 (MSVC) Qt5
337341
os: windows-2022
@@ -350,6 +354,7 @@ jobs:
350354
cc: cl
351355
cxx: cl
352356
rustc_wrapper: sccache
357+
cargo_target: x86_64-pc-windows-msvc
353358
- name: Windows 2022 (MSVC2019) Qt6
354359
os: windows-2022
355360
qt_version: 6
@@ -367,6 +372,7 @@ jobs:
367372
cc: cl
368373
cxx: cl
369374
rustc_wrapper: sccache
375+
cargo_target: x86_64-pc-windows-msvc
370376
- name: Windows 2022 (MSVC2022) Qt6
371377
os: windows-2022
372378
qt_version: 6
@@ -384,6 +390,7 @@ jobs:
384390
cc: cl
385391
cxx: cl
386392
rustc_wrapper: sccache
393+
cargo_target: x86_64-pc-windows-msvc
387394

388395
runs-on: ${{ matrix.os }}
389396
name: ${{ matrix.name }}
@@ -397,6 +404,8 @@ jobs:
397404
SCCACHE_CACHE_SIZE: 600M
398405
SCCACHE_LOG: debug
399406
SCCACHE_ERROR_LOG: ${{ matrix.sccache_log_path }}
407+
# Ensure that we share the same target sub folder
408+
CARGO_BUILD_TARGET: ${{ matrix.cargo_target }}
400409

401410
steps:
402411
- name: "Clone Git repository"

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ if(BUILD_TESTING)
148148
set_tests_properties(cargo_tests cargo_clippy PROPERTIES
149149
ENVIRONMENT_MODIFICATION "${CARGO_ENV}"
150150
)
151+
# Cargo doc cannot have a target set otherwise it fails
152+
# https://github.com/rust-lang/cargo/issues/10368
151153
set_tests_properties(cargo_doc PROPERTIES
152-
ENVIRONMENT_MODIFICATION "${CARGO_ENV};RUSTDOCFLAGS=set:--deny=warnings"
154+
ENVIRONMENT_MODIFICATION "${CARGO_ENV};RUSTDOCFLAGS=set:--deny=warnings;CARGO_BUILD_TARGET=unset"
153155
)
154156

155157
# Ensure test inputs and outputs are formatted

0 commit comments

Comments
 (0)