Skip to content

Commit

Permalink
Merge branch 'main' into norunfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre authored Mar 31, 2024
2 parents d2ea1dd + 63fbedb commit e1855f4
Show file tree
Hide file tree
Showing 1,757 changed files with 57,699 additions and 30,890 deletions.
141 changes: 96 additions & 45 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ 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/..."
- "-//test/unpretty/..."
default_linux_targets: &default_linux_targets
- "--"
- "//..."
Expand Down Expand Up @@ -52,19 +53,14 @@ tasks:
# test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
run_targets:
- //test:query_test_binary
rbe_ubuntu2004:
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"
build_targets: *default_linux_targets
test_targets: *default_linux_targets
macos:
build_targets: *default_macos_targets
test_targets: *default_macos_targets
Expand Down Expand Up @@ -126,27 +122,17 @@ tasks:
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
build_targets: *default_linux_targets
test_targets: *default_linux_targets
rbe_ubuntu2004_rolling_with_aspects:
name: RBE Rolling Bazel Version With Aspects
platform: rbe_ubuntu2004
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"
test_targets: *default_linux_targets
build_flags: *aspects_flags
soft_fail: yes
bazel: "rolling"
Expand Down Expand Up @@ -186,6 +172,13 @@ tasks:
test_targets: *default_windows_targets
soft_fail: yes
bazel: "rolling"
ubuntu2004_unpretty:
name: Unpretty
platform: ubuntu2004
build_targets: *default_linux_targets
test_targets: *default_linux_targets
build_flags:
- "--config=unpretty"
ubuntu2004_bzlmod_only:
name: With bzlmod
platform: ubuntu2004
Expand Down Expand Up @@ -337,6 +330,17 @@ tasks:
platform: ubuntu2004
run_targets:
- "//test/rust_analyzer:rust_analyzer_test"
rust_analyzer_integration_test:
name: Rust-Analyzer Integration Test
platform: ubuntu2004
run_targets:
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
examples_rust_analyzer_integration_test:
name: Rust-Analyzer Integration Test
platform: ubuntu2004
working_directory: examples
run_targets:
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
ubuntu2004_examples:
name: Examples
platform: ubuntu2004
Expand All @@ -358,21 +362,22 @@ tasks:
- "//..."
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:
- "//..."
# TODO: https://github.com/bazelbuild/rules_rust/issues/2554
# 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
Expand All @@ -383,12 +388,6 @@ tasks:
- "//..."
build_flags: *aspects_flags
soft_fail: yes
ubuntu2004_examples_bzlmod:
name: Bzlmod Examples
platform: ubuntu2004
working_directory: examples/bzlmod/hello_world
build_targets:
- "//..."
rbe_ubuntu2004_examples:
name: Examples
platform: rbe_ubuntu2004
Expand Down Expand Up @@ -594,6 +593,12 @@ tasks:
- "--android_platforms=//:arm64-v8a"
build_targets:
- "//:android_app"
environment:
# This ndk version matches with rules_android_ndk repo's CI
# https://github.com/bazelbuild/rules_android_ndk/blob/877c68ef34c9f3353028bf490d269230c1990483/.bazelci/presubmit.yml#L37
# The ndk is installed by this script
# https://github.com/bazelbuild/continuous-integration/blob/ba56013373821feadd9f2eaa6b81eb19528795f0/macos/mac-android.sh
ANDROID_NDK_HOME: /opt/android-ndk-r25b
android_examples_macos:
name: Android Examples
platform: macos
Expand All @@ -604,6 +609,12 @@ tasks:
- "--android_platforms=//:arm64-v8a"
build_targets:
- "//:android_app"
environment:
# This ndk version matches with rules_android_ndk repo's CI
# https://github.com/bazelbuild/rules_android_ndk/blob/877c68ef34c9f3353028bf490d269230c1990483/.bazelci/presubmit.yml#L42
# The ndk is installed by this script
# https://github.com/bazelbuild/continuous-integration/blob/ba56013373821feadd9f2eaa6b81eb19528795f0/macos/mac-android.sh
ANDROID_NDK_HOME: /Users/buildkite/android-ndk-r25b
ios_examples:
name: iOS Examples
platform: macos
Expand All @@ -626,21 +637,61 @@ tasks:
# working_directory: examples/zig_cross_compiling
# build_targets:
# - "//..."
musl_cross_compiling_macos_to_linux:
name: Musl cross compiling test from macOS to Linux
platform: macos
working_directory: examples/musl_cross_compiling
build_targets:
- "//..."
test_targets:
- "//..."
nix_cross_compiling:
name: Nix cross compiling test
platform: ubuntu2204
working_directory: examples/nix_cross_compiling
setup:
- curl -L https://nixos.org/nix/install | bash
- sudo cp ~/.nix-profile/bin/nix* /usr/local/bin/
- sudo mkdir /etc/nix
- echo "experimental-features = nix-command flakes" | sudo tee --append /etc/nix/nix.conf
build_targets:
# Root `build_test` target is called directly to catch missing platforms
# that would otherwise be quietly skipped due to `target_compatible_with`.
- "//:nix_cross_compiling"
test_targets:
- "//..."
ubuntu2004_bzlmod_bcr:
name: bzlmod BCR presubmit
platform: ubuntu2004
working_directory: examples/bzlmod/hello_world
run_targets:
- "//third-party:vendor"
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
test_targets:
- "//..."
macos_bzlmod_bcr:
name: bzlmod BCR presubmit
platform: macos
working_directory: examples/bzlmod/hello_world
run_targets:
- "//third-party:vendor"
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
test_targets:
- "//..."
windows_bzlmod_bcr:
name: bzlmod BCR presubmit
platform: windows
working_directory: examples/bzlmod/hello_world
run_targets:
- "//third-party:vendor"
build_targets:
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
test_targets:
- "//..."
bzlmod_no_cargo:
name: Cargo-less bzlmod
platform: ubuntu2004
working_directory: examples/bzlmod/hello_world_no_cargo
build_targets:
- "//..."

buildifier:
version: latest
Expand Down
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bzlmod
docs
examples
crate_universe/private/bootstrap
Expand Down
28 changes: 20 additions & 8 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ coverage --combined_report=lcov
# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
coverage --experimental_fetch_all_coverage_outputs

# Required for some of the tests
# https://bazel.build/reference/command-line-reference#flag--experimental_cc_shared_library
common --experimental_cc_shared_library

###############################################################################
## Unique configuration groups
###############################################################################
Expand All @@ -45,6 +49,14 @@ build:rustfmt --output_groups=+rustfmt_checks
build:clippy --aspects=//rust:defs.bzl%rust_clippy_aspect
build:clippy --output_groups=+clippy_checks

# Enable unpretty for all targets in the workspace
build:unpretty --aspects=//rust:defs.bzl%rust_unpretty_aspect
build:unpretty --output_groups=+rust_unpretty

# `unpretty` requires the nightly toolchain. See tracking issue:
# https://github.com/rust-lang/rust/issues/43364
build:unpretty --//rust/toolchain/channel=nightly

###############################################################################
## Incompatibility flags
###############################################################################
Expand All @@ -55,14 +67,6 @@ build --incompatible_disallow_empty_glob=true
# https://github.com/bazelbuild/bazel/issues/12821
build --nolegacy_external_runfiles

###############################################################################
## Custom user flags
##
## This should always be the last thing in the `.bazelrc` file to ensure
## consistent behavior when setting flags in that file as `.bazelrc` files are
## evaluated top to bottom.
###############################################################################

###############################################################################
## Bzlmod
###############################################################################
Expand All @@ -71,4 +75,12 @@ build --nolegacy_external_runfiles
# https://github.com/bazelbuild/rules_rust/issues/2181
common --noenable_bzlmod

###############################################################################
## Custom user flags
##
## This should always be the last thing in the `.bazelrc` file to ensure
## consistent behavior when setting flags in that file as `.bazelrc` files are
## evaluated top to bottom.
###############################################################################

try-import %workspace%/user.bazelrc
1 change: 0 additions & 1 deletion .bcr/presubmit.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
bcr_test_module:
module_path: ""
matrix:
platform: ["macos", "ubuntu2004"]
bazel: ["6.x", "7.x"]
tasks:
run_tests:
working_directory: examples/bzlmod/hello_world
name: "Run test module"
platform: ${{ platform }}
bazel: ${{ bazel }}
run_targets:
- "//third-party:vendor"
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
test_targets:
- "//..."
# Windows is run separately because currently gen_rust_project doesn't run on windows, although it does build
bcr_test_module_windows:
module_path: ""
matrix:
bazel: ["6.x", "7.x"]
tasks:
run_tests:
working_directory: examples/bzlmod/hello_world
name: "Run test module"
platform: windows
bazel: ${{ bazel }}
run_targets:
- "//third-party:vendor"
build_targets:
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
test_targets:
- "//..."
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# - https://marketplace.visualstudio.com/items?itemName=mkhl.direnv

# Use `path:` syntax to avoid copying the entire repo to the Nix Store.
nix_direnv_watch_file ./nix/flake.nix
watch_file ./nix/flake.nix
use flake path:./nix
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
bindgen/3rdparty/crates/** linguist-generated
crate_universe/3rdparty/crates/** linguist-generated
crate_universe/test_data/metadata/*/metadata.json linguist-generated
examples/bzlmod/hello_world/third-party/crates/** linguist-generated
examples/crate_universe/vendor_external/crates/** linguist-generated
examples/crate_universe/vendor_local_manifests/crates/** linguist-generated
examples/crate_universe/vendor_local_pkgs/crates/** linguist-generated
Expand Down
2 changes: 1 addition & 1 deletion .github/release_notes.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust",
sha256 = "{sha256}",
integrity = "sha256-{sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-v{version}.tar.gz"],
)
```
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,12 @@ jobs:
# Update urls and sha256 values
bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator -- --artifacts-dir="${ARTIFACTS_DIR}" --url-prefix="${URL_PREFIX}"
bazel clean
# Build an archive of the repo contents
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz --exclude=".git" --exclude=".github" --exclude="examples" --exclude="crate_universe/target" -C ${{ github.workspace }} .
# Build an archive of the repo contents.
# `examples/bzlmod` is included for the BCR presubmit; it must appear before --exclude="examples"
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz -C ${{ github.workspace }} --exclude=".git" --exclude=".github" --exclude="crate_universe/target" examples/bzlmod --exclude="examples" .
# Save the sha256 checksum of the distro archive to the environment
sha256="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust.tar.gz | awk '{ print $1 }')"
echo "ARCHIVE_SHA256=${sha256}" >> $GITHUB_ENV
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
env:
CARGO_BAZEL_GENERATOR_URL: file://${{ github.workspace }}/crate_universe/target/artifacts/x86_64-unknown-linux-gnu/cargo-bazel
ARTIFACTS_DIR: ${{ github.workspace }}/crate_universe/target/artifacts
Expand All @@ -146,8 +147,8 @@ jobs:
- name: Generate release notes
run: |
# Generate the release notes
sed 's/{version}/${{ env.RELEASE_VERSION }}/g' ${{ github.workspace }}/.github/release_notes.template \
| sed 's/{sha256}/${{ env.ARCHIVE_SHA256 }}/g' \
sed 's#{version}#${{ env.RELEASE_VERSION }}#g' ${{ github.workspace }}/.github/release_notes.template \
| sed 's#{sha256_base64}#${{ env.ARCHIVE_SHA256_BASE64 }}#g' \
> ${{ github.workspace }}/.github/release_notes.txt
- name: Create release
uses: softprops/action-gh-release@v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# bazel
/bazel-*
/bzlmod/hello_world/bazel-*
/examples/bazel-*
/examples/cargo_manifest_dir/external_crate/bazel-*
/examples/crate_universe/bazel-*
Expand All @@ -14,6 +15,7 @@
/test/no_std/bazel-*
/docs/bazel-*
user.bazelrc
MODULE.bazel.lock

# rustfmt
*.rs.bk
Expand Down
Loading

0 comments on commit e1855f4

Please sign in to comment.