Skip to content

Commit

Permalink
ci: set the CARGO_BUILD_TARGET to reuse same cache
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ahayzen-kdab committed Feb 18, 2025
1 parent ce6b261 commit 2f73836
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/github-cxx-qt-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ jobs:
clang_format_path: /home/runner/.local/bin/clang-format
cargo_dir: ~/.cargo
rustc_wrapper: sccache
cargo_target: x86_64-unknown-linux-gnu
- name: Ubuntu 24.04 (gcc) Qt6
os: ubuntu-24.04
qt_version: 6
Expand All @@ -289,6 +290,7 @@ jobs:
libgl1-mesa-dev
libvulkan-dev
libxkbcommon-dev
cargo_target: x86_64-unknown-linux-gnu

- name: macOS 13 (clang) Qt5
os: macos-13
Expand All @@ -311,6 +313,7 @@ jobs:
cc: clang
cxx: clang++
rustc_wrapper: sccache
cargo_target: x86_64-apple-darwin
- name: macOS 14 (clang) Qt6
os: macos-14
qt_version: 6
Expand All @@ -332,6 +335,7 @@ jobs:
cc: clang
cxx: clang++
rustc_wrapper: sccache
cargo_target: aarch64-apple-darwin

- name: Windows 2022 (MSVC) Qt5
os: windows-2022
Expand All @@ -350,6 +354,7 @@ jobs:
cc: cl
cxx: cl
rustc_wrapper: sccache
cargo_target: x86_64-pc-windows-msvc
- name: Windows 2022 (MSVC2019) Qt6
os: windows-2022
qt_version: 6
Expand All @@ -367,6 +372,7 @@ jobs:
cc: cl
cxx: cl
rustc_wrapper: sccache
cargo_target: x86_64-pc-windows-msvc
- name: Windows 2022 (MSVC2022) Qt6
os: windows-2022
qt_version: 6
Expand All @@ -384,6 +390,7 @@ jobs:
cc: cl
cxx: cl
rustc_wrapper: sccache
cargo_target: x86_64-pc-windows-msvc

runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
Expand All @@ -397,6 +404,8 @@ jobs:
SCCACHE_CACHE_SIZE: 600M
SCCACHE_LOG: debug
SCCACHE_ERROR_LOG: ${{ matrix.sccache_log_path }}
# Ensure that we share the same target sub folder
CARGO_BUILD_TARGET: ${{ matrix.cargo_target }}

steps:
- name: "Clone Git repository"
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ if(BUILD_TESTING)
set_tests_properties(cargo_tests cargo_clippy PROPERTIES
ENVIRONMENT_MODIFICATION "${CARGO_ENV}"
)
# Cargo doc cannot have a target set otherwise it fails
# https://github.com/rust-lang/cargo/issues/10368
set_tests_properties(cargo_doc PROPERTIES
ENVIRONMENT_MODIFICATION "${CARGO_ENV};RUSTDOCFLAGS=set:--deny=warnings"
ENVIRONMENT_MODIFICATION "${CARGO_ENV};RUSTDOCFLAGS=set:--deny=warnings;CARGO_BUILD_TARGET=unset"
)

# Ensure test inputs and outputs are formatted
Expand Down

0 comments on commit 2f73836

Please sign in to comment.