Skip to content

Commit 26a24f0

Browse files
authored
Added CI for single toolchain channel workspaces (#1712)
* Added CI for single toolchain channel workspaces * Addressed clippy warnings
1 parent caed7d8 commit 26a24f0

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

.bazelci/presubmit.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ aspects_flags: &aspects_flags
44
- "--config=clippy"
55
min_rust_version_shell_commands: &min_rust_version_shell_commands
66
- sed -i 's|^rust_register_toolchains(|rust_register_toolchains(versions = ["1.59.0"],\n|' WORKSPACE.bazel
7+
nightly_flags: &nightly_flags
8+
- "--//rust/toolchain/channel=nightly"
9+
nightly_aspects_flags: &nightly_aspects_flags
10+
- "--//rust/toolchain/channel=nightly"
11+
- "--config=rustfmt"
12+
- "--config=clippy"
713
single_rust_channel_targets: &single_rust_channel_targets
814
- "--"
915
- "//..."
@@ -219,9 +225,48 @@ tasks:
219225
name: "Min Rust Version With Aspects"
220226
platform: ubuntu2004
221227
shell_commands: *min_rust_version_shell_commands
228+
build_flags: *aspects_flags
229+
build_targets: *single_rust_channel_targets
230+
test_flags: *aspects_flags
231+
test_targets: *single_rust_channel_targets
232+
ubuntu2004_stable_toolchain:
233+
name: "Only Stable Toolchain"
234+
platform: ubuntu2004
235+
# Test rules while only registering a nightly toolchain
236+
shell_commands:
237+
- sed -i 's|^rust_register_toolchains(|load("//rust/private:common.bzl", "DEFAULT_RUST_VERSION")\nrust_register_toolchains(versions = [DEFAULT_RUST_VERSION],\n|' WORKSPACE.bazel
222238
build_targets: *single_rust_channel_targets
223239
test_targets: *single_rust_channel_targets
240+
ubuntu2004_stable_with_aspects:
241+
name: "Only Stable Toolchain With Aspects"
242+
platform: ubuntu2004
243+
# Test rules while only registering a nightly toolchain
244+
shell_commands:
245+
- sed -i 's|^rust_register_toolchains(|load("//rust/private:common.bzl", "DEFAULT_RUST_VERSION")\nrust_register_toolchains(versions = [DEFAULT_RUST_VERSION],\n|' WORKSPACE.bazel
224246
build_flags: *aspects_flags
247+
build_targets: *single_rust_channel_targets
248+
test_flags: *aspects_flags
249+
test_targets: *single_rust_channel_targets
250+
ubuntu2004_nightly_toolchain:
251+
name: "Only Nightly Toolchain"
252+
platform: ubuntu2004
253+
# Test rules while only registering a nightly toolchain
254+
shell_commands:
255+
- sed -i 's|^rust_register_toolchains(|load("//rust/private:common.bzl", "DEFAULT_NIGHTLY_ISO_DATE")\nrust_register_toolchains(versions = ["nightly/" + DEFAULT_NIGHTLY_ISO_DATE],\n|' WORKSPACE.bazel
256+
build_flags: *nightly_flags
257+
build_targets: *single_rust_channel_targets
258+
test_flags: *nightly_flags
259+
test_targets: *single_rust_channel_targets
260+
ubuntu2004_nightly_with_aspects:
261+
name: "Only Nightly Toolchain With Aspects"
262+
platform: ubuntu2004
263+
# Test rules while only registering a nightly toolchain
264+
shell_commands:
265+
- sed -i 's|^rust_register_toolchains(|load("//rust/private:common.bzl", "DEFAULT_NIGHTLY_ISO_DATE")\nrust_register_toolchains(versions = ["nightly/" + DEFAULT_NIGHTLY_ISO_DATE],\n|' WORKSPACE.bazel
266+
build_flags: *nightly_aspects_flags
267+
build_targets: *single_rust_channel_targets
268+
test_flags: *nightly_aspects_flags
269+
test_targets: *single_rust_channel_targets
225270
ubuntu2004_rolling_with_aspects:
226271
name: "Rolling Bazel Version With Aspects"
227272
bazel: "rolling"

test/cargo_build_script/tools_exec.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pub fn test_tool_exec() {
33
let tool_path = env!("TOOL_PATH");
44
assert!(
55
tool_path.contains("-exec-"),
6-
"tool_path did not contain '-exec-': {}",
7-
tool_path
6+
"tool_path did not contain '-exec-'",
87
);
98
}

test/process_wrapper/rustc_quit_on_rmeta.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ mod test {
6868
]);
6969
assert!(
7070
!out_content.contains("should not be in output"),
71-
"output should not contain 'should not be in output' but did: {}",
72-
out_content
71+
"output should not contain 'should not be in output' but did",
7372
);
7473
}
7574

test/rustfmt/rustfmt_failure_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cd "${BUILD_WORKSPACE_DIRECTORY}"
2323
function check_build_result() {
2424
local ret=0
2525
echo -n "Testing ${2}... "
26-
(bazel test //test/rustfmt:"${2}" &> /dev/null) || ret="$?" && true
26+
(bazel test //test/rustfmt:"${2}") || ret="$?" && true
2727
if [[ "${ret}" -ne "${1}" ]]; then
2828
echo "FAIL: Unexpected return code [saw: ${ret}, want: ${1}] building target //test/rustfmt:${2}"
2929
echo " Run \"bazel test //test/rustfmt:${2}\" to see the output"

0 commit comments

Comments
 (0)