Skip to content

Commit

Permalink
Merge branch 'main' into toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
scentini authored Aug 24, 2023
2 parents d1cea1e + 81af2f9 commit fecb02a
Show file tree
Hide file tree
Showing 1,932 changed files with 107,686 additions and 45,385 deletions.
97 changes: 54 additions & 43 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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
- sed -i 's|^rust_register_toolchains(|rust_register_toolchains(versions = ["1.62.0"],\n|' WORKSPACE.bazel
nightly_flags: &nightly_flags
- "--//rust/toolchain/channel=nightly"
nightly_aspects_flags: &nightly_aspects_flags
Expand All @@ -24,7 +24,6 @@ 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
- "//..."
- "-//bindgen/..."
- "-//test/proto/..."
- "-//test/unit/pipelined_compilation/..."
crate_universe_vendor_example_targets: &crate_universe_vendor_example_targets
Expand All @@ -36,11 +35,23 @@ crate_universe_vendor_example_targets: &crate_universe_vendor_example_targets
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 \
; }
split_coverage_postprocessing_shell_commands: &split_coverage_postprocessing_shell_commands
- echo "coverage --experimental_fetch_all_coverage_outputs" >> user.bazelrc
- echo "coverage --experimental_split_coverage_postprocessing" >> user.bazelrc
- echo "build --//rust/settings:experimental_use_coverage_metadata_files" >> user.bazelrc
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
Expand All @@ -51,21 +62,29 @@ tasks:
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
- "//test/..."
- "-//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_flags:
- "--enable_runfiles" # this is not enabled by default on windows and is necessary for the cargo build scripts
test_flags:
- "--enable_runfiles"
build_targets: *default_windows_targets
test_targets: *default_windows_targets
ubuntu2004_split_coverage_postprocessing:
name: Split Coverage Postprocessing
platform: ubuntu2004
shell_commands: *split_coverage_postprocessing_shell_commands
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
macos_split_coverage_postprocessing:
name: Split Coverage Postprocessing
platform: macos
shell_commands: *split_coverage_postprocessing_shell_commands
coverage_targets: *default_macos_targets
post_shell_commands: *coverage_validation_post_shell_commands
ubuntu2004_opt:
name: Opt Mode
platform: ubuntu2004
Expand All @@ -88,19 +107,19 @@ tasks:
name: Opt Mode
platform: windows
build_flags:
- "--enable_runfiles" # this is not enabled by default on windows and is necessary for the cargo build scripts
- "--compilation_mode=opt"
test_flags:
- "--enable_runfiles"
- "--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
build_flags: *aspects_flags
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
rbe_ubuntu1604_with_aspects:
name: With Aspects
platform: rbe_ubuntu1604
Expand All @@ -110,8 +129,7 @@ tasks:
build_targets: *default_linux_targets
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "..."
- "//test/..."
- "//..."
- "-//test/conflicting_deps:conflicting_deps_test"
# TODO: This test does not work on RBE
- "-//test/versioned_dylib:versioned_dylib_test"
Expand All @@ -125,8 +143,7 @@ tasks:
build_targets: *default_linux_targets
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "..."
- "//test/..."
- "//..."
- "-//test/conflicting_deps:conflicting_deps_test"
# TODO: This test does not work on RBE
- "-//test/versioned_dylib:versioned_dylib_test"
Expand All @@ -136,37 +153,35 @@ tasks:
macos_with_aspects:
name: With Aspects
platform: macos
build_flags: *aspects_flags
build_targets: *default_macos_targets
test_targets: *default_macos_targets
build_flags: *aspects_flags
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
build_flags: *aspects_flags
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:
- "--enable_runfiles" # this is not enabled by default on windows and is necessary for the cargo build scripts
- "--config=rustfmt"
- "--config=clippy"
test_flags:
- "--enable_runfiles"
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:
- "--enable_runfiles" # this is not enabled by default on windows and is necessary for the cargo build scripts
- "--config=rustfmt"
- "--config=clippy"
test_flags:
- "--enable_runfiles"
build_targets: *default_windows_targets
test_targets: *default_windows_targets
soft_fail: yes
Expand Down Expand Up @@ -206,17 +221,21 @@ tasks:
ubuntu1804:
name: "Min Bazel Version"
# If updating the minimum bazel version, please also update /docs/index.md
bazel: "5.0.0"
bazel: "6.0.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.0.0"
bazel: "6.0.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
Expand Down Expand Up @@ -273,10 +292,12 @@ tasks:
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
build_flags: *aspects_flags
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
linux_docs:
name: Docs
platform: ubuntu2004
Expand Down Expand Up @@ -315,11 +336,12 @@ tasks:
working_directory: examples
build_flags:
- "--repo_env=CC=clang"
- "--config=rustfmt"
- "--config=clippy"
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
ubuntu2004_examples_clang_lld:
name: Examples with Clang and LLD
platform: ubuntu2004
Expand All @@ -329,11 +351,12 @@ tasks:
build_flags:
- "--repo_env=CC=clang"
- "--linkopt=-fuse-ld=lld"
- "--config=rustfmt"
- "--config=clippy"
build_targets:
- "//..."
test_targets:
- "//..."
build_flags: *aspects_flags
ubuntu2004_examples_rolling:
name: "Examples with Rolling Bazel Version"
platform: ubuntu2004
Expand Down Expand Up @@ -361,9 +384,6 @@ tasks:
- "-//sys/..."
# See https://github.com/bazelbuild/bazel/issues/9987
- "-//ffi/rust_calling_c:matrix_dylib_test"
# The bindgen rules currently do not work on RBE
# see: https://github.com/bazelbuild/rules_rust/issues/919
- "-//bindgen/..."
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
Expand All @@ -385,21 +405,18 @@ tasks:
platform: windows
working_directory: examples
build_flags:
- "--enable_runfiles" # this is not enabled by default on windows and is necessary for the cargo build scripts
- "--config=rustfmt"
- "--config=clippy"
test_flags:
- "--enable_runfiles"
windows_targets: &windows_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
# The bindgen rules currently do not work on windows
# see: https://github.com/bazelbuild/rules_rust/issues/919
- "-//bindgen/..."
# 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:
Expand Down Expand Up @@ -472,9 +489,6 @@ tasks:
name: Crate Universe Examples
platform: windows
working_directory: examples/crate_universe
batch_commands:
- echo startup --windows_enable_symlinks >> user.bazelrc
- echo build --enable_runfiles >> user.bazelrc # this is not enabled by default on windows and is necessary for the cargo build scripts
run_targets: *crate_universe_vendor_example_targets
build_flags: *aspects_flags
build_targets:
Expand All @@ -485,9 +499,6 @@ tasks:
name: Crate Universe Unnamed Examples
platform: windows
working_directory: examples/crate_universe_unnamed
batch_commands:
- echo startup --windows_enable_symlinks >> user.bazelrc
- echo build --enable_runfiles >> user.bazelrc # this is not enabled by default on windows and is necessary for the cargo build scripts
run_targets: *crate_universe_unnamed_vendor_example_targets
build_flags: *aspects_flags
build_targets:
Expand Down Expand Up @@ -585,7 +596,7 @@ tasks:
- "--apple_platform_type=ios"
test_targets:
- "//..."
# TODO: https://github.com/bazelbuild/rules_rust/issues/1892
# TODO: https://github.com/bazelbuild/rules_rust/issues/2075
# zig_cross_compiling:
# name: Zig cross compiling test
# platform: ubuntu2004
Expand Down
12 changes: 12 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@
## https://bazel.build/docs/best-practices#bazelrc-file
###############################################################################

# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
common --enable_platform_specific_config

# https://bazel.build/docs/windows#symlink
startup --windows_enable_symlinks
build:windows --enable_runfiles

# Enable the only currently supported report type
# https://bazel.build/reference/command-line-reference#flag--combined_report
coverage --combined_report=lcov

# Avoid fully cached builds reporting no coverage and failing CI
# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
coverage --experimental_fetch_all_coverage_outputs

###############################################################################
## Unique configuration groups
Expand Down
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
BasedOnStyle: Google
IndentWidth: 4
...
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ examples/crate_universe_unnamed/vendor_remote_manifests/crates/** linguist-gener
examples/crate_universe_unnamed/vendor_remote_pkgs/crates/** linguist-generated
examples/sys/basic/3rdparty/crates/** linguist-generated
examples/sys/complex/3rdparty/crates/** linguist-generated
proto/3rdparty/crates/** linguist-generated
proto/prost/private/3rdparty/crates/** linguist-generated
proto/protobuf/3rdparty/crates/** linguist-generated
tools/rust_analyzer/3rdparty/crates/** linguist-generated
util/import/3rdparty/crates/** linguist-generated
wasm_bindgen/3rdparty/crates/** linguist-generated
21 changes: 21 additions & 0 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Formatting

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize

jobs:
clang-format-checking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: '.'
extensions: 'h,c,cc,proto'
clangFormatVersion: 14
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(

print("WARNING: The rules_rust Bazel module is still highly experimental and subject to change at any time. Only use it to try out bzlmod for now.") # buildifier: disable=print

bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "rules_cc", version = "0.0.1")
bazel_dep(name = "bazel_skylib", version = "1.2.0")
bazel_dep(name = "apple_support", version = "1.3.1")
Expand Down
Loading

0 comments on commit fecb02a

Please sign in to comment.