blob: eaf1ffcf875e73a0263d83e571e51f4cd5e90056 [file] [log] [blame]
---
aspects_flags: &aspects_flags
- "--config=rustfmt"
- "--config=clippy"
min_rust_version_shell_commands: &min_rust_version_shell_commands
- sed -i 's|^rust_register_toolchains(|rust_register_toolchains(versions = ["1.59.0"],\n|' WORKSPACE.bazel
nightly_flags: &nightly_flags
- "--//rust/toolchain/channel=nightly"
nightly_aspects_flags: &nightly_aspects_flags
- "--//rust/toolchain/channel=nightly"
- "--config=rustfmt"
- "--config=clippy"
single_rust_channel_targets: &single_rust_channel_targets
- "--"
- "//..."
# These tests are expected to fail as they require both a nightly and stable toolchain.
- "-//test/unit/channel_transitions/..."
default_linux_targets: &default_linux_targets
- "--"
- "//..."
default_macos_targets: &default_macos_targets
- "--"
- "//..."
default_windows_targets: &default_windows_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
- "-//test/proto/..."
- "-//test/unit/pipelined_compilation/..."
crate_universe_vendor_example_targets: &crate_universe_vendor_example_targets
- "//vendor_external:crates_vendor"
- "//vendor_local_manifests:crates_vendor"
- "//vendor_local_pkgs:crates_vendor"
- "//vendor_remote_manifests:crates_vendor"
- "//vendor_remote_pkgs:crates_vendor"
crate_universe_unnamed_vendor_example_targets: &crate_universe_unnamed_vendor_example_targets
- "//vendor_remote_manifests:crates_vendor"
- "//vendor_remote_pkgs:crates_vendor"
coverage_validation_post_shell_commands: &coverage_validation_post_shell_commands
- |
grep -q '^SF:.*\.rs$' bazel-out/_coverage/_coverage_report.dat \
|| { 1>&2 echo "Failed to find any Rust coverage" \
; 1>&2 cat bazel-out/_coverage/_coverage_report.dat \
; exit 1 \
; }
tasks:
ubuntu2004:
build_targets: *default_linux_targets
test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
rbe_ubuntu1604:
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
build_targets:
- "--"
- "//..."
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
- "-//test/conflicting_deps:conflicting_deps_test"
# TODO: This test does not work on RBE
- "-//test/versioned_dylib:versioned_dylib_test"
macos:
build_targets: *default_macos_targets
test_targets: *default_macos_targets
coverage_targets: *default_macos_targets
post_shell_commands: *coverage_validation_post_shell_commands
windows:
build_targets: *default_windows_targets
test_targets: *default_windows_targets
ubuntu2004_opt:
name: Opt Mode
platform: ubuntu2004
build_targets: *default_linux_targets
test_targets: *default_linux_targets
build_flags:
- "--compilation_mode=opt"
test_flags:
- "--compilation_mode=opt"
macos_opt:
name: Opt Mode
platform: macos
build_targets: *default_macos_targets
test_targets: *default_macos_targets
build_flags:
- "--compilation_mode=opt"
test_flags:
- "--compilation_mode=opt"
windows_opt:
name: Opt Mode
platform: windows
build_flags:
- "--compilation_mode=opt"
test_flags:
- "--compilation_mode=opt"
build_targets: *default_windows_targets
test_targets: *default_windows_targets
ubuntu2004_with_aspects:
name: With Aspects
platform: ubuntu2004
build_flags: *aspects_flags
build_targets: *default_linux_targets
test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
rbe_ubuntu1604_with_aspects:
name: With Aspects
platform: rbe_ubuntu1604
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
build_targets: *default_linux_targets
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
- "-//test/conflicting_deps:conflicting_deps_test"
# TODO: This test does not work on RBE
- "-//test/versioned_dylib:versioned_dylib_test"
build_flags: *aspects_flags
rbe_ubuntu1604_rolling_with_aspects:
name: RBE Rolling Bazel Version With Aspects
platform: rbe_ubuntu1604
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
build_targets: *default_linux_targets
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
- "-//test/conflicting_deps:conflicting_deps_test"
# TODO: This test does not work on RBE
- "-//test/versioned_dylib:versioned_dylib_test"
build_flags: *aspects_flags
soft_fail: yes
bazel: "rolling"
macos_with_aspects:
name: With Aspects
platform: macos
build_flags: *aspects_flags
build_targets: *default_macos_targets
test_targets: *default_macos_targets
coverage_targets: *default_macos_targets
post_shell_commands: *coverage_validation_post_shell_commands
macos_rolling_with_aspects:
name: "Macos Rolling Bazel Version With Aspects"
platform: macos
build_flags: *aspects_flags
build_targets: *default_macos_targets
test_targets: *default_macos_targets
coverage_targets: *default_macos_targets
post_shell_commands: *coverage_validation_post_shell_commands
soft_fail: yes
bazel: "rolling"
windows_with_aspects:
name: With Aspects
platform: windows
build_flags:
- "--config=rustfmt"
- "--config=clippy"
build_targets: *default_windows_targets
test_targets: *default_windows_targets
windows_rolling_with_aspects:
name: "Windows Rolling Bazel Version With Aspects"
platform: windows
build_flags:
- "--config=rustfmt"
- "--config=clippy"
build_targets: *default_windows_targets
test_targets: *default_windows_targets
soft_fail: yes
bazel: "rolling"
ubuntu2004_clang:
name: With Clang
platform: ubuntu2004
build_flags:
- "--config=rustfmt"
- "--config=clippy"
- "--repo_env=CC=clang"
build_targets: *default_linux_targets
test_targets: *default_linux_targets
ubuntu2004_clang_lld:
name: With Clang and LLD
platform: ubuntu2004
shell_commands:
- "sudo apt -y update && sudo apt -y install lld"
build_flags:
- "--config=rustfmt"
- "--config=clippy"
- "--repo_env=CC=clang"
- "--linkopt=-fuse-ld=lld"
build_targets: *default_linux_targets
test_targets: *default_linux_targets
ubuntu2004_rolling_clang:
name: Rolling Bazel Version With Clang
platform: ubuntu2004
build_flags:
- "--config=rustfmt"
- "--config=clippy"
- "--repo_env=CC=clang"
build_targets: *default_linux_targets
test_targets: *default_linux_targets
soft_fail: yes
bazel: "rolling"
ubuntu1804:
name: "Min Bazel Version"
# If updating the minimum bazel version, please also update /docs/index.md
bazel: "5.2.0"
platform: ubuntu1804
build_targets: *default_linux_targets
test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
ubuntu1804_with_aspects:
name: "Min Bazel Version With Aspects"
bazel: "5.2.0"
platform: ubuntu1804
build_targets: *default_linux_targets
test_targets: *default_linux_targets
build_flags: *aspects_flags
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
ubuntu2004_min_rust_version:
name: "Min Rust Version"
platform: ubuntu2004
shell_commands: *min_rust_version_shell_commands
build_targets: *single_rust_channel_targets
test_targets: *single_rust_channel_targets
ubuntu2004_min_rust_version_with_aspects:
name: "Min Rust Version With Aspects"
platform: ubuntu2004
shell_commands: *min_rust_version_shell_commands
build_flags: *aspects_flags
build_targets: *single_rust_channel_targets
test_flags: *aspects_flags
test_targets: *single_rust_channel_targets
ubuntu2004_stable_toolchain:
name: "Only Stable Toolchain"
platform: ubuntu2004
# Test rules while only registering a nightly toolchain
shell_commands:
- sed -i 's|^rust_register_toolchains(|load("//rust/private:common.bzl", "DEFAULT_RUST_VERSION")\nrust_register_toolchains(versions = [DEFAULT_RUST_VERSION],\n|' WORKSPACE.bazel
build_targets: *single_rust_channel_targets
test_targets: *single_rust_channel_targets
ubuntu2004_stable_with_aspects:
name: "Only Stable Toolchain With Aspects"
platform: ubuntu2004
# Test rules while only registering a nightly toolchain
shell_commands:
- sed -i 's|^rust_register_toolchains(|load("//rust/private:common.bzl", "DEFAULT_RUST_VERSION")\nrust_register_toolchains(versions = [DEFAULT_RUST_VERSION],\n|' WORKSPACE.bazel
build_flags: *aspects_flags
build_targets: *single_rust_channel_targets
test_flags: *aspects_flags
test_targets: *single_rust_channel_targets
ubuntu2004_nightly_toolchain:
name: "Only Nightly Toolchain"
platform: ubuntu2004
# Test rules while only registering a nightly toolchain
shell_commands:
- 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
build_flags: *nightly_flags
build_targets: *single_rust_channel_targets
test_flags: *nightly_flags
test_targets: *single_rust_channel_targets
ubuntu2004_nightly_with_aspects:
name: "Only Nightly Toolchain With Aspects"
platform: ubuntu2004
# Test rules while only registering a nightly toolchain
shell_commands:
- 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
build_flags: *nightly_aspects_flags
build_targets: *single_rust_channel_targets
test_flags: *nightly_aspects_flags
test_targets: *single_rust_channel_targets
ubuntu2004_rolling_with_aspects:
name: "Rolling Bazel Version With Aspects"
bazel: "rolling"
platform: ubuntu2004
build_flags: *aspects_flags
soft_fail: yes
build_targets: *default_linux_targets
test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
linux_docs:
name: Docs
platform: ubuntu2004
working_directory: docs
build_targets:
- //...
run_targets:
- "//:test_docs"
clippy_failure:
name: Negative Clippy Tests
platform: ubuntu2004
run_targets:
- "//test/clippy:clippy_failure_test"
rustfmt_failure:
name: Negative Rustfmt Tests
platform: ubuntu2004
run_targets:
- "//test/rustfmt:rustfmt_integration_test_suite.test_runner"
rust_analyzer_tests:
name: Rust-Analyzer Tests
platform: ubuntu2004
run_targets:
- "//test/rust_analyzer:rust_analyzer_test"
ubuntu2004_examples:
name: Examples
platform: ubuntu2004
working_directory: examples
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
ubuntu2004_examples_clang:
name: Examples with Clang
platform: ubuntu2004
working_directory: examples
build_flags:
- "--repo_env=CC=clang"
- "--config=rustfmt"
- "--config=clippy"
build_targets:
- "//..."
test_targets:
- "//..."
ubuntu2004_examples_clang_lld:
name: Examples with Clang and LLD
platform: ubuntu2004
shell_commands:
- "sudo apt -y update && sudo apt -y install lld"
working_directory: examples
build_flags:
- "--repo_env=CC=clang"
- "--linkopt=-fuse-ld=lld"
- "--config=rustfmt"
- "--config=clippy"
build_targets:
- "//..."
test_targets:
- "//..."
ubuntu2004_examples_rolling:
name: "Examples with Rolling Bazel Version"
platform: ubuntu2004
working_directory: examples
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
soft_fail: yes
ubuntu2004_examples_bzlmod:
name: Bzlmod Examples
platform: ubuntu2004
working_directory: examples/bzlmod/hello_world
build_targets:
- "//..."
rbe_ubuntu1604_examples:
name: Examples
platform: rbe_ubuntu1604
working_directory: examples
rbe_examples_targets: &rbe_examples_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
# TODO: This requires an updated `rules_foreign_cc`
- "-//sys/..."
# See https://github.com/bazelbuild/bazel/issues/9987
- "-//ffi/rust_calling_c:matrix_dylib_test"
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
build_targets: *rbe_examples_targets
test_targets: *rbe_examples_targets
build_flags: *aspects_flags
macos_examples:
name: Examples
platform: macos
working_directory: examples
build_targets:
- "//..."
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
build_flags: *aspects_flags
windows_examples:
name: Examples
platform: windows
working_directory: examples
build_flags:
- "--config=rustfmt"
- "--config=clippy"
windows_targets: &windows_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
# The proto rules do not work on windows
- "-//proto/..."
# The wasm rules do not work on windows
- "-//wasm/..."
# The bindgen rules are currently broken on windows
# https://github.com/bazelbuild/rules_rust/issues/2009
- "-//bindgen/..."
build_targets: *windows_targets
test_targets: *windows_targets
crate_universe_examples_ubuntu2004:
name: Crate Universe Examples
platform: ubuntu2004
working_directory: examples/crate_universe
run_targets: *crate_universe_vendor_example_targets
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
crate_universe_unnamed_examples_ubuntu2004:
name: Crate Universe Unnamed Examples
platform: ubuntu2004
working_directory: examples/crate_universe_unnamed
run_targets: *crate_universe_unnamed_vendor_example_targets
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
crate_universe_rbe_ubuntu1604:
name: Crate Universe Examples
platform: rbe_ubuntu1604
working_directory: examples/crate_universe
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
run_targets: *crate_universe_vendor_example_targets
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
crate_universe_unnamed_rbe_ubuntu1604:
name: Crate Universe Unnamed Examples
platform: rbe_ubuntu1604
working_directory: examples/crate_universe_unnamed
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
run_targets: *crate_universe_unnamed_vendor_example_targets
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
crate_universe_examples_macos:
name: Crate Universe Examples
platform: macos
working_directory: examples/crate_universe
run_targets: *crate_universe_vendor_example_targets
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
crate_universe_unnamed_examples_macos:
name: Crate Universe Unnamed Examples
platform: macos
working_directory: examples/crate_universe_unnamed
run_targets: *crate_universe_unnamed_vendor_example_targets
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
crate_universe_examples_windows:
name: Crate Universe Examples
platform: windows
working_directory: examples/crate_universe
run_targets: *crate_universe_vendor_example_targets
build_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
crate_universe_unnamed_examples_windows:
name: Crate Universe Unnamed Examples
platform: windows
working_directory: examples/crate_universe_unnamed
run_targets: *crate_universe_unnamed_vendor_example_targets
build_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
cc_common_link_ubuntu2004:
name: Build via cc_common.link
platform: ubuntu2004
working_directory: test/cc_common_link
build_targets:
- "--"
- "//..."
# The with_global_alloc directory is a repository on its own tested in the 'Build via cc_common.link using a global allocator' task.
- "-//with_global_alloc/..."
test_targets:
- "--"
- "//..."
# The with_global_alloc directory is a repository on its own tested in the 'Build via cc_common.link using a global allocator' task.
- "-//with_global_alloc/..."
build_flags:
- "--@rules_rust//rust/settings:experimental_use_cc_common_link=True"
test_flags:
- "--@rules_rust//rust/settings:experimental_use_cc_common_link=True"
cc_common_link_with_global_alloc_ubuntu2004:
name: Build via cc_common.link using a global allocator
platform: ubuntu2004
working_directory: test/cc_common_link/with_global_alloc
build_targets:
- "//..."
test_targets:
- "//..."
build_flags:
- "--@rules_rust//rust/settings:experimental_use_cc_common_link=True"
- "--@rules_rust//rust/settings:experimental_use_global_allocator=True"
test_flags:
- "--@rules_rust//rust/settings:experimental_use_cc_common_link=True"
- "--@rules_rust//rust/settings:experimental_use_global_allocator=True"
cc_common_link_no_std_ubuntu2004:
name: Build with no_std + alloc using cc_common.link infrastructure for linking
platform: ubuntu2004
working_directory: test/no_std
build_targets:
- "//..."
test_targets:
- "//..."
build_flags:
- "--@rules_rust//rust/toolchain/channel=nightly"
- "--@rules_rust//rust/settings:experimental_use_cc_common_link=True"
- "--@rules_rust//rust/settings:experimental_use_global_allocator=True"
- "--@rules_rust//:no_std=alloc"
test_flags:
- "--@rules_rust//rust/toolchain/channel=nightly"
- "--@rules_rust//rust/settings:experimental_use_cc_common_link=True"
- "--@rules_rust//rust/settings:experimental_use_global_allocator=True"
- "--@rules_rust//:no_std=alloc"
no_std_ubuntu2004:
name: Build with no_std + alloc
platform: ubuntu2004
working_directory: test/no_std
build_targets:
- "//..."
test_targets:
- "//..."
build_flags:
- "--@rules_rust//rust/toolchain/channel=nightly"
- "--@rules_rust//:no_std=alloc"
test_flags:
- "--@rules_rust//rust/toolchain/channel=nightly"
- "--@rules_rust//:no_std=alloc"
android_examples_ubuntu2004:
name: Android Examples
platform: ubuntu2004
working_directory: examples/android
build_targets:
- "//:android_app"
android_examples_macos:
name: Android Examples
platform: macos
working_directory: examples/android
build_targets:
- "//:android_app"
ios_examples:
name: iOS Examples
platform: macos
working_directory: examples/ios
build_targets:
- "//..."
ios_build:
name: iOS build script cross compile test
platform: macos
working_directory: examples/ios_build
test_flags:
- "--cpu=ios_x86_64"
- "--apple_platform_type=ios"
test_targets:
- "//..."
# TODO: https://github.com/bazelbuild/rules_rust/issues/1892
# zig_cross_compiling:
# name: Zig cross compiling test
# platform: ubuntu2004
# working_directory: examples/zig_cross_compiling
# build_targets:
# - "//..."
buildifier:
version: latest
warnings: "all"