Skip to content

Commit 7417574

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 96d3233 commit 7417574

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ jobs:
287287
cargo_dir: ~/.cargo
288288
rustc_wrapper: sccache
289289
build_type: Release
290+
cargo_target: x86_64-unknown-linux-gnu
290291
- name: Ubuntu 24.04 (gcc) Qt6
291292
os: ubuntu-24.04
292293
qt_version: 6
@@ -308,6 +309,7 @@ jobs:
308309
libgl1-mesa-dev
309310
libvulkan-dev
310311
libxkbcommon-dev
312+
cargo_target: x86_64-unknown-linux-gnu
311313

312314
- name: macOS 13 (clang) Qt5
313315
os: macos-13
@@ -331,6 +333,7 @@ jobs:
331333
cxx: clang++
332334
rustc_wrapper: sccache
333335
build_type: Release
336+
cargo_target: x86_64-apple-darwin
334337
- name: macOS 14 (clang) Qt6
335338
os: macos-14
336339
qt_version: 6
@@ -353,6 +356,7 @@ jobs:
353356
cxx: clang++
354357
rustc_wrapper: sccache
355358
build_type: Release
359+
cargo_target: aarch64-apple-darwin
356360

357361
- name: Windows 2022 (MSVC) Qt5
358362
os: windows-2022
@@ -372,6 +376,7 @@ jobs:
372376
cxx: cl
373377
rustc_wrapper: sccache
374378
build_type: Release
379+
cargo_target: x86_64-pc-windows-msvc
375380
- name: Windows 2022 (MSVC2019) Qt6
376381
os: windows-2022
377382
qt_version: 6
@@ -390,6 +395,7 @@ jobs:
390395
cxx: cl
391396
rustc_wrapper: sccache
392397
build_type: Release
398+
cargo_target: x86_64-pc-windows-msvc
393399
# Use a Debug build to ensure we can build and run tests in Debug mode with MSVC
394400
- name: Windows 2022 (MSVC2022) Qt6 Debug
395401
os: windows-2022
@@ -409,6 +415,7 @@ jobs:
409415
cxx: cl
410416
rustc_wrapper: sccache
411417
build_type: Debug
418+
cargo_target: x86_64-pc-windows-msvc
412419

413420
runs-on: ${{ matrix.os }}
414421
name: ${{ matrix.name }}
@@ -422,6 +429,8 @@ jobs:
422429
SCCACHE_CACHE_SIZE: 600M
423430
SCCACHE_LOG: debug
424431
SCCACHE_ERROR_LOG: ${{ matrix.sccache_log_path }}
432+
# Ensure that we share the same target sub folder
433+
CARGO_BUILD_TARGET: ${{ matrix.cargo_target }}
425434

426435
steps:
427436
- name: "Clone Git repository"

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ if(BUILD_TESTING)
157157
set_tests_properties(cargo_tests cargo_clippy PROPERTIES
158158
ENVIRONMENT_MODIFICATION "${CARGO_ENV}"
159159
)
160+
# Cargo doc cannot have a target set otherwise it fails
161+
# https://github.com/rust-lang/cargo/issues/10368
160162
set_tests_properties(cargo_doc PROPERTIES
161-
ENVIRONMENT_MODIFICATION "${CARGO_ENV};RUSTDOCFLAGS=set:--deny=warnings"
163+
ENVIRONMENT_MODIFICATION "${CARGO_ENV};RUSTDOCFLAGS=set:--deny=warnings;CARGO_BUILD_TARGET=unset:;"
162164
)
163165

164166
# Ensure test inputs and outputs are formatted

0 commit comments

Comments
 (0)