From 11af16c9838f0a693040c693e98a64c68c0c2da0 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 24 Apr 2024 17:06:11 +0300 Subject: use precompiled rustc for non-dist builders by default Signed-off-by: onur-ozkan --- src/ci/run.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ci') diff --git a/src/ci/run.sh b/src/ci/run.sh index c8201d9bcfd..06e3b573758 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -173,6 +173,10 @@ else # included with LLVM, since a dynamic libstdcpp may not be available. RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.static-libstdcpp" fi + + if [ "$NO_DOWNLOAD_CI_RUSTC" = "" ]; then + RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.download-rustc=if-unchanged" + fi fi if [ "$ENABLE_GCC_CODEGEN" = "1" ]; then -- cgit 1.4.1-3-g733a5 From 9826e3ece3a5a52e9cc2af5401218f4bd71a749a Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 24 Apr 2024 19:59:46 +0300 Subject: disable CI rustc when not using CI LLVM Signed-off-by: onur-ozkan --- src/ci/run.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ci') diff --git a/src/ci/run.sh b/src/ci/run.sh index 06e3b573758..c33a376c2d6 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -169,6 +169,8 @@ else if [ "$NO_DOWNLOAD_CI_LLVM" = "" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.download-ci-llvm=if-unchanged" else + # CI rustc requires CI LLVM to be enabled (see https://github.com/rust-lang/rust/issues/123586). + NO_DOWNLOAD_CI_RUSTC=1 # When building for CI we want to use the static C++ Standard library # included with LLVM, since a dynamic libstdcpp may not be available. RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.static-libstdcpp" -- cgit 1.4.1-3-g733a5 From b21949b9623b236617746c8dd4c98f9e110cced6 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Sun, 12 May 2024 10:31:43 +0300 Subject: make an explicit change on compiler then run bootstrap test Signed-off-by: onur-ozkan --- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 15 ++++++++++++++- src/ci/github-actions/jobs.yml | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/ci') diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index 571378774be..97fe56fbfcb 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -46,7 +46,20 @@ ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 # Check library crates on all tier 1 targets. # We disable optimized compiler built-ins because that requires a C toolchain for the target. # We also skip the x86_64-unknown-linux-gnu target as it is well-tested by other jobs. -ENV SCRIPT python3 ../x.py check --stage 0 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ +ENV SCRIPT \ + # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test covers the `rust.download-rustc=if-unchanged` logic. + # Here we are adding a dummy commit on compiler and running that test to ensure when there is a change on the compiler, + # we never download ci rustc with `rust.download-rustc=if-unchanged` option. + echo \"\" >> ../compiler/rustc/src/main.rs && \ + git config --global user.email \"dummy@dummy.com\" && \ + git config --global user.name \"dummy\" && \ + git add ../compiler/rustc/src/main.rs && \ + git commit -m \"test commit for rust.download-rustc=if-unchanged logic\" && \ + python3 ../x.py test bootstrap -- core::builder::tests::ci_rustc_if_unchanged_logic && \ + # Revert the dummy commit + git reset --hard HEAD~1 && \ + + python3 ../x.py check --stage 0 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ /scripts/check-default-config-profiles.sh && \ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ python3 ../x.py clippy bootstrap -Dwarnings && \ diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 6379f1ade1c..e8ad4319aff 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -85,6 +85,9 @@ envs: # it in each job definition. pr: - image: mingw-check + env: + # We are adding (temporarily) a dummy commit on the compiler + READ_ONLY_SRC: "0" <<: *job-linux-4c - image: mingw-check-tidy continue_on_error: true -- cgit 1.4.1-3-g733a5 From ee5f51af30a009d08a76e99b005e0cbe03359873 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Tue, 28 May 2024 11:56:15 +0300 Subject: disable read-only mode in mingw-check image for merge pipeline Signed-off-by: onur-ozkan --- src/ci/github-actions/jobs.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ci') diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index e8ad4319aff..4bbebbc4697 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -210,6 +210,8 @@ auto: <<: *job-linux-8c - image: mingw-check + env: + READ_ONLY_SRC: 0 <<: *job-linux-4c - image: test-various -- cgit 1.4.1-3-g733a5 From a3bb170e370e5711ec401fe971411b40cfc254c8 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Tue, 28 May 2024 19:17:00 +0300 Subject: disable download-rustc on x86_64-gnu-integration Signed-off-by: onur-ozkan --- src/ci/docker/host-x86_64/x86_64-fuchsia/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ci') diff --git a/src/ci/docker/host-x86_64/x86_64-fuchsia/Dockerfile b/src/ci/docker/host-x86_64/x86_64-fuchsia/Dockerfile index ba3e8bdb687..0cae83a85b3 100644 --- a/src/ci/docker/host-x86_64/x86_64-fuchsia/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-fuchsia/Dockerfile @@ -58,6 +58,9 @@ RUN mkdir -p $RUST_INSTALL_DIR/etc # Fuchsia only supports LLVM. ENV CODEGEN_BACKENDS llvm +# download-rustc is not allowed for `x install` +ENV NO_DOWNLOAD_CI_RUSTC 1 + ENV RUST_CONFIGURE_ARGS \ --prefix=$RUST_INSTALL_DIR \ --sysconfdir=etc \ @@ -70,6 +73,7 @@ ENV RUST_CONFIGURE_ARGS \ --set target.x86_64-unknown-fuchsia.ar=/usr/local/bin/llvm-ar \ --set target.x86_64-unknown-fuchsia.ranlib=/usr/local/bin/llvm-ranlib \ --set target.x86_64-unknown-fuchsia.linker=/usr/local/bin/ld.lld + ENV SCRIPT \ python3 ../x.py install --target $TARGETS compiler/rustc library/std clippy && \ bash ../src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh -- cgit 1.4.1-3-g733a5 From 8a5f418f147204ca3803b986db36d4867cc1cf20 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Mon, 5 Aug 2024 15:04:39 +0300 Subject: handle CI rustc incompatible runners Signed-off-by: onur-ozkan --- src/ci/docker/run.sh | 1 + src/ci/run.sh | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'src/ci') diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index fad4b5af095..28487bce482 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -343,6 +343,7 @@ docker \ --env PR_CI_JOB \ --env OBJDIR_ON_HOST="$objdir" \ --env CODEGEN_BACKENDS \ + --env DISABLE_CI_RUSTC_IF_INCOMPATIBLE="$DISABLE_CI_RUSTC_IF_INCOMPATIBLE" \ --init \ --rm \ rust-ci \ diff --git a/src/ci/run.sh b/src/ci/run.sh index c33a376c2d6..8a8d26f8302 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -52,6 +52,11 @@ if [ "$CI" != "" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set change-id=99999999" fi +# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined, switch to in-tree rustc. +if [ "$FORCE_CI_RUSTC" == "" ]; then + DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1 +fi + if ! isCI || isCiBranch auto || isCiBranch beta || isCiBranch try || isCiBranch try-perf || \ isCiBranch automation/bors/try; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.print-step-timings --enable-verbose-tests" -- cgit 1.4.1-3-g733a5 From abac4dc8889bc741d1c1880c89abb8c1ca4420f8 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Mon, 5 Aug 2024 16:26:39 +0300 Subject: fix `ci_rustc_if_unchanged_logic` test Signed-off-by: onur-ozkan --- src/bootstrap/src/core/builder/tests.rs | 25 ++++++++++++------------ src/bootstrap/src/core/config/config.rs | 5 +++-- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 2 +- src/ci/run.sh | 3 ++- 4 files changed, 18 insertions(+), 17 deletions(-) (limited to 'src/ci') diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 363a9c82699..3d2e3daf915 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1,5 +1,7 @@ use std::thread; +use build_helper::git::get_closest_merge_commit; + use super::*; use crate::Flags; use crate::core::build_steps::doc::DocumentationFormat; @@ -223,31 +225,30 @@ fn ci_rustc_if_unchanged_logic() { |&_| Ok(Default::default()), ); - let build = Build::new(config.clone()); - let builder = Builder::new(&build); - if config.rust_info.is_from_tarball() { return; } + let build = Build::new(config.clone()); + let builder = Builder::new(&build); + if config.out.exists() { fs::remove_dir_all(&config.out).unwrap(); } builder.run_step_descriptions(&Builder::get_step_descriptions(config.cmd.kind()), &[]); - let commit = helpers::get_closest_merge_base_commit( + let compiler_path = build.src.join("compiler"); + let library_path = build.src.join("compiler"); + + let commit = get_closest_merge_commit( Some(&builder.config.src), &builder.config.git_config(), - &builder.config.stage0_metadata.config.git_merge_commit_email, - &[], + &[compiler_path.clone(), library_path.clone()], ) .unwrap(); - let compiler_path = build.src.join("compiler"); - let library_path = build.src.join("library"); - - let has_changes = helpers::git(Some(&builder.src)) + let has_changes = !helpers::git(Some(&builder.src)) .args(["diff-index", "--quiet", &commit]) .arg("--") .args([compiler_path, library_path]) @@ -256,9 +257,7 @@ fn ci_rustc_if_unchanged_logic() { .unwrap() .success(); - assert!( - has_changes != config.out.join(config.build.to_string()).join("ci-rustc-sysroot").exists() - ); + assert!(has_changes == config.download_rustc_commit.is_none()); } mod defaults { diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index e3641254b19..76e3343e86f 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -2422,8 +2422,9 @@ impl Config { ci_config_toml, ); - let disable_ci_rustc_if_incompatible = - env::var_os("DISABLE_CI_RUSTC_IF_INCOMPATIBLE") + // Primarily used by CI runners to avoid handling download-rustc incompatible + // options one by one on shell scripts. + let disable_ci_rustc_if_incompatible = env::var_os("DISABLE_CI_RUSTC_IF_INCOMPATIBLE") .is_some_and(|s| s == "1" || s == "true"); if disable_ci_rustc_if_incompatible && res.is_err() { diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index 97fe56fbfcb..467ca1dac67 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -55,7 +55,7 @@ ENV SCRIPT \ git config --global user.name \"dummy\" && \ git add ../compiler/rustc/src/main.rs && \ git commit -m \"test commit for rust.download-rustc=if-unchanged logic\" && \ - python3 ../x.py test bootstrap -- core::builder::tests::ci_rustc_if_unchanged_logic && \ + DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 python3 ../x.py test bootstrap -- core::builder::tests::ci_rustc_if_unchanged_logic && \ # Revert the dummy commit git reset --hard HEAD~1 && \ diff --git a/src/ci/run.sh b/src/ci/run.sh index 8a8d26f8302..457f36bdd20 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -52,7 +52,8 @@ if [ "$CI" != "" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set change-id=99999999" fi -# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined, switch to in-tree rustc. +# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined, +# switch to in-tree rustc. if [ "$FORCE_CI_RUSTC" == "" ]; then DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1 fi -- cgit 1.4.1-3-g733a5 From 4082f9f77567b6b5b61f411d9c08b66853e87a95 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Fri, 16 Aug 2024 21:57:28 +0300 Subject: force `download-rustc=if-unchanged` for x86_64-gnu-tools runner Signed-off-by: onur-ozkan --- src/bootstrap/src/core/builder/tests.rs | 12 ++++++------ src/bootstrap/src/core/config/config.rs | 9 ++++----- src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile | 1 + src/ci/run.sh | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/ci') diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 3d2e3daf915..4a96ecf1421 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -241,12 +241,12 @@ fn ci_rustc_if_unchanged_logic() { let compiler_path = build.src.join("compiler"); let library_path = build.src.join("compiler"); - let commit = get_closest_merge_commit( - Some(&builder.config.src), - &builder.config.git_config(), - &[compiler_path.clone(), library_path.clone()], - ) - .unwrap(); + let commit = + get_closest_merge_commit(Some(&builder.config.src), &builder.config.git_config(), &[ + compiler_path.clone(), + library_path.clone(), + ]) + .unwrap(); let has_changes = !helpers::git(Some(&builder.src)) .args(["diff-index", "--quiet", &commit]) diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 76e3343e86f..9f84b492b80 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -2736,11 +2736,10 @@ impl Config { // Look for a version to compare to based on the current commit. // Only commits merged by bors will have CI artifacts. - let commit = get_closest_merge_commit( - Some(&self.src), - &self.git_config(), - &[self.src.join("compiler"), self.src.join("library")], - ) + let commit = get_closest_merge_commit(Some(&self.src), &self.git_config(), &[ + self.src.join("compiler"), + self.src.join("library"), + ]) .unwrap(); if commit.is_empty() { println!("ERROR: could not find commit hash for downloading rustc"); diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 145f41f21e1..17fc1a57492 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -84,6 +84,7 @@ ENV RUST_CONFIGURE_ARGS \ --enable-new-symbol-mangling ENV HOST_TARGET x86_64-unknown-linux-gnu +ENV FORCE_CI_RUSTC 1 COPY host-x86_64/dist-x86_64-linux/shared.sh /scripts/ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ diff --git a/src/ci/run.sh b/src/ci/run.sh index 457f36bdd20..1ce54f9ecb3 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -55,6 +55,7 @@ fi # If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined, # switch to in-tree rustc. if [ "$FORCE_CI_RUSTC" == "" ]; then + echo "debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured." DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1 fi -- cgit 1.4.1-3-g733a5