diff --git a/.gitlab-ci/build/gitlab-ci.yml b/.gitlab-ci/build/gitlab-ci.yml index 39b9c0337c6..3b3dae9b02b 100644 --- a/.gitlab-ci/build/gitlab-ci.yml +++ b/.gitlab-ci/build/gitlab-ci.yml @@ -61,7 +61,7 @@ - .use-debian/x86_64_build stage: build-only script: - - &meson-build timeout --verbose ${BUILD_JOB_TIMEOUT_OVERRIDE:-$BUILD_JOB_TIMEOUT} .gitlab-ci/meson/build.sh + - &meson-build timeout --verbose ${BUILD_JOB_TIMEOUT_OVERRIDE:-$BUILD_JOB_TIMEOUT} bash --login .gitlab-ci/meson/build.sh # Make sure this list stays the same as all the jobs with diff --git a/.gitlab-ci/container/build-rust.sh b/.gitlab-ci/container/build-rust.sh index 344327adfeb..c8746688b58 100644 --- a/.gitlab-ci/container/build-rust.sh +++ b/.gitlab-ci/container/build-rust.sh @@ -7,12 +7,6 @@ set -ex uncollapsed_section_start rust "Building Rust toolchain" -# cargo (and rustup) wants to store stuff in $HOME/.cargo, and binaries in -# $HOME/.cargo/bin. Make bin a link to a public bin directory so the commands -# are just available to all build jobs. -mkdir -p "$HOME"/.cargo -ln -s /usr/local/bin "$HOME"/.cargo/bin - # Pick a specific snapshot from rustup so the compiler doesn't drift on us. RUST_VERSION=1.78.0-2024-05-02 @@ -25,6 +19,10 @@ curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \ --profile minimal \ -y +# Make rustup tools available in the PATH environment variable +# shellcheck disable=SC1091 +. "$HOME/.cargo/env" + rustup component add clippy rustfmt # Set up a config script for cross compiling -- cargo needs your system cc for diff --git a/.gitlab-ci/container/container_post_build.sh b/.gitlab-ci/container/container_post_build.sh index 5700f488f20..090879b23bb 100755 --- a/.gitlab-ci/container/container_post_build.sh +++ b/.gitlab-ci/container/container_post_build.sh @@ -6,8 +6,6 @@ fi # Clean up any build cache rm -rf /root/.cache -rm -rf /root/.cargo -rm -rf /.cargo if test -x /usr/bin/ccache; then ccache --show-stats diff --git a/.gitlab-ci/container/container_pre_build.sh b/.gitlab-ci/container/container_pre_build.sh index b4238a5b45b..86cdc6e36eb 100755 --- a/.gitlab-ci/container/container_pre_build.sh +++ b/.gitlab-ci/container/container_pre_build.sh @@ -42,3 +42,10 @@ echo -e "retry_connrefused = on\n" \ "retry_on_host_error = on\n" \ "retry_on_http_error = 429,500,502,503,504\n" \ "wait_retry = 32" >> /etc/wgetrc + +# Ensure that rust tools are in PATH if they exist +CARGO_ENV_FILE="$HOME/.cargo/env" +if [ -f "$CARGO_ENV_FILE" ]; then + # shellcheck disable=SC1090 + source "$CARGO_ENV_FILE" +fi diff --git a/.gitlab-ci/image-tags.yml b/.gitlab-ci/image-tags.yml index 7fda5f7b20f..5a5222e8809 100644 --- a/.gitlab-ci/image-tags.yml +++ b/.gitlab-ci/image-tags.yml @@ -13,7 +13,7 @@ variables: DEBIAN_X86_64_BUILD_BASE_IMAGE: "debian/x86_64_build-base" - DEBIAN_BASE_TAG: "20250213-rustup" + DEBIAN_BASE_TAG: "20250218-rustup" DEBIAN_X86_64_BUILD_IMAGE_PATH: "debian/x86_64_build" DEBIAN_BUILD_TAG: "20250210-android-drm" diff --git a/.gitlab-ci/test/gitlab-ci.yml b/.gitlab-ci/test/gitlab-ci.yml index 89c1bec89b5..d55d24169d3 100644 --- a/.gitlab-ci/test/gitlab-ci.yml +++ b/.gitlab-ci/test/gitlab-ci.yml @@ -40,6 +40,7 @@ rustfmt: - .lint-rustfmt-rules before_script: - shopt -s globstar + - source "$HOME/.cargo/env" - rustfmt --version - rustfmt --verbose src/**/lib.rs