Skip to content

Commit 5c31c72

Browse files
committed
Added CI for single toolchain channel workspaces
1 parent ac8e735 commit 5c31c72

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
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/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)