Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to Bazel 7.0.2 #119

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@
# Take care to document any settings that you expect users to apply.
# Settings that apply only to CI are in .github/workflows/ci.bazelrc

# Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is
# Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS
# identifiers are `linux`, `macos`, `windows`, `freebsd`, and `openbsd`. Enabling this flag is
# equivalent to using `--config=linux` on Linux, `--config=windows` on Windows, etc.
# Docs: https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
common --enable_platform_specific_config

# Required by rules_js
# Runfiles still required for Windows in this repository despite not
# being strictly necessary for rules_js support with
# https://github.com/aspect-build/rules_js/pull/1428 landed.
# TODO: fix broken targets on Windows and remove this flag
build --enable_runfiles

# Filter out tests depending on platform
test:windows --test_tag_filters=-no-windows

# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
# This needs to be last statement in this
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
6.4.0
7.0.2
# The first line of this file is used by Bazelisk and Bazel to be sure
# the right version of Bazel is used to build and test this repo.
# This also defines which version is used on CI.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/aspect-workflows-warming.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- name: Configure environment
run: ${ASPECT_WORKFLOWS_BIN_DIR}/configure_workflows_env
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Agent health checks
run: ${ASPECT_WORKFLOWS_BIN_DIR}/agent_health_check
- name: Create warming archive
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# This file contains Bazel settings to apply on CI only.
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml
# Directories caches by GitHub actions
common --disk_cache=~/.cache/bazel-disk-cache
common --repository_cache=~/.cache/bazel-repository-cache

# Bazel version specific settings
common:bazel6 --build_tag_filters=-skip-on-bazel6
common:bazel6 --test_tag_filters=-skip-on-bazel6
common:bazel7 --build_tag_filters=-skip-on-bazel7
common:bazel7 --test_tag_filters=-skip-on-bazel7

# Debug where options came from
build --announce_rc
# This directory is configured in GitHub actions to be persisted between runs.
build --disk_cache=~/.cache/bazel
build --repository_cache=~/.cache/bazel-repo
# Don't rely on test logs being easily accessible from the test runner,
# though it makes the log noisier.
test --test_output=errors
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
test --test_env=XDG_CACHE_HOME

# Required by rules_js
build --enable_runfiles
build --enable_runfiles
101 changes: 98 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,102 @@ concurrency:
cancel-in-progress: true

jobs:
# Prepares dynamic test matrix values
matrix-prep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: bazel-version
name: Prepare 'bazel-version' matrix axis
run: |
v=$(head -n 1 .bazelversion)
m=${v::1}
a=(
"major:$m, version:\"$v\""
"major:6, version:\"6.5.0\""
)
printf -v j '{%s},' "${a[@]}"
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
- id: os
name: Prepare 'os' matrix axis
# Only run MacOS and Windows on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively)
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
run: |
a=( ubuntu )
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"macos"* ]]; then
a+=( macos )
fi
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"windows"* ]]; then
a+=( windows )
fi
printf -v j '"%s",' "${a[@]}"
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
outputs:
bazel-version: ${{ steps.bazel-version.outputs.res }}
os: ${{ steps.os.outputs.res }}

test:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v2
with:
folders: '[".", "e2e/jasmine_test", "e2e/smoke"]'
runs-on: ${{ matrix.os }}-latest
needs:
- matrix-prep
strategy:
fail-fast: false
matrix:
bazel-version: ${{ fromJSON(needs.matrix-prep.outputs.bazel-version) }}
bzlmod: [1, 0]
os: ${{ fromJSON(needs.matrix-prep.outputs.os) }}
folder:
- '.'
- 'e2e/jasmine_test'
- 'e2e/smoke'
exclude:
# Don't test MacOS and Windows against secondary bazel version to minimize minutes (billed at 10X and 2X respectively)
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
- os: macos
bazel-version:
major: 6
- os: windows
bazel-version:
major: 6

steps:
- uses: actions/checkout@v4

- name: Mount bazel caches
uses: actions/cache@v3
with:
path: |
~/.cache/bazel-disk-cache
~/.cache/bazel-repository-cache
~/.cache/xdg-cache
key: bazel-cache-${{ matrix.bazelversion.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', 'MODULE.bazel.lock') }}
restore-keys: bazel-cache-${{ matrix.bazelversion.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-

- name: Configure Bazel version
working-directory: ${{ matrix.folder }}
shell: bash
run: |
# Overwrite the .bazelversion instead of using USE_BAZEL_VERSION so that Bazelisk
# still bootstraps Aspect CLI from configuration in .bazeliskrc. Aspect CLI will
# then use .bazelversion to determine which Bazel version to use.
echo "${{ matrix.bazel-version.version }}" > .bazelversion
# TODO: remove this block once we have Aspect CLI Windows releases
- name: Don't use Aspect CLI on Windows
if: matrix.os == 'windows'
working-directory: ${{ matrix.folder }}
shell: bash
run: rm -f .bazeliskrc

- name: bazel test //...
working-directory: ${{ matrix.folder }}
shell: bash
run: |
bazel \
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \
test \
--config=bazel${{ matrix.bazel-version.major }} \
--enable_bzlmod=${{ matrix.bzlmod }} \
//...
env:
XDG_CACHE_HOME: ~/.cache/xdg-cache # bazelisk will download bazel to here
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@ bazel-*
.bazelrc.user
.idea/
.ijwb/
node_modules
node_modules

# Don't commit lockfile for now as it is unstable. Do allow for it to be
# created, however, since it gives a performance boost for local development.
# https://github.com/bazelbuild/bazel/issues/19026
# https://github.com/bazelbuild/bazel/issues/19621
# https://github.com/bazelbuild/bazel/issues/19971
# https://github.com/bazelbuild/bazel/issues/20272
# https://github.com/bazelbuild/bazel/issues/20369
MODULE.bazel.lock
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ default_stages: [commit]
repos:
# Check formatting and lint for starlark code
- repo: https://github.com/keith/pre-commit-buildifier
rev: 4.0.1.1
rev: 6.4.0
hooks:
- id: buildifier
- id: buildifier-lint
Expand Down
15 changes: 9 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.32.0")
bazel_dep(name = "aspect_rules_js", version = "1.29.2")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_nodejs", version = "5.8.2")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.2")
bazel_dep(name = "aspect_rules_js", version = "1.37.1")
bazel_dep(name = "bazel_features", version = "1.4.1")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_nodejs", version = "5.8.3")

bazel_dep(name = "gazelle", version = "0.29.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "buildifier_prebuilt", version = "6.0.0.1", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "0.11.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.35.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")
23 changes: 22 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,31 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
############################################
# Stardoc
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")

stardoc_repositories()

load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps")

stardoc_external_deps()

load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")

stardoc_pinned_maven_install()

############################################
# Gazelle, for generating bzl_library targets
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()
Expand Down
8 changes: 7 additions & 1 deletion docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ stardoc_with_diff_test(
name = "jasmine_test",
bzl_library_target = "//jasmine:defs",
symbol_names = ["jasmine_test"],
tags = ["skip-on-bazel6"],
)

update_docs(name = "update")
update_docs(
name = "update",
# Failure on Bazel 6.5.0 with bzlmod enabled with unknown root cause not worth investigating:
# "Stardoc documentation generation failed: File /home/runner/.cache/bazel/_bazel_runner/49ae4abee64f46f5e03b51e3020410d1/sandbox/linux-sandbox/168/execroot/_main/bazel-out/k8-opt-exec-2B5CBBC6/bin/docs/jasmine_test_stardoc.runfiles/_main/jasmine/private/jasmine_test.bzl imported '@aspect_rules_js//js:libs.bzl', yet /home/runner/.cache/bazel/_bazel_runner/49ae4abee64f46f5e03b51e3020410d1/sandbox/linux-sandbox/168/execroot/_main/bazel-out/k8-opt-exec-2B5CBBC6/bin/docs/jasmine_test_stardoc.runfiles/aspect_rules_js/js/libs.bzl was not found."
tags = ["skip-on-bazel6"],
)

# Demonstration delivery target for Aspect Workflows.
# In the future this could be wired up to push to a demonstration S3 bucket.
Expand Down
14 changes: 7 additions & 7 deletions docs/jasmine_test.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/jasmine_test/.bazelversion
1 change: 1 addition & 0 deletions e2e/smoke/.bazelversion
2 changes: 1 addition & 1 deletion e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "aspect_rules_js", version = "1.29.2")
bazel_dep(name = "aspect_rules_js", version = "1.37.1")

bazel_dep(name = "aspect_rules_jasmine", version = "0.0.0", dev_dependency = True)

Expand Down
24 changes: 12 additions & 12 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ def rules_jasmine_internal_deps():
"Fetch deps needed for local development"
http_archive(
name = "io_bazel_rules_go",
sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip"],
sha256 = "6734a719993b1ba4ebe9806e853864395a8d3968ad27f9dd759c196b3eb3abe8",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/v0.45.1/rules_go-v0.45.1.zip"],
)

http_archive(
name = "bazel_gazelle",
sha256 = "448e37e0dbf61d6fa8f00aaa12d191745e14f07c31cabfa731f0c8e8a4f41b97",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.28.0/bazel-gazelle-v0.28.0.tar.gz"],
sha256 = "32938bda16e6700063035479063d9d24c60eda8d79fd4739563f50d331cb3209",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz"],
)

http_archive(
Expand All @@ -31,22 +31,22 @@ def rules_jasmine_internal_deps():

http_archive(
name = "io_bazel_stardoc",
sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb",
urls = ["https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz"],
sha256 = "62bd2e60216b7a6fec3ac79341aa201e0956477e7c8f6ccc286f279ad1d96432",
urls = ["https://github.com/bazelbuild/stardoc/releases/download/0.6.2/stardoc-0.6.2.tar.gz"],
)

http_archive(
name = "buildifier_prebuilt",
sha256 = "72b5bb0853aac597cce6482ee6c62513318e7f2c0050bc7c319d75d03d8a3875",
strip_prefix = "buildifier-prebuilt-6.3.3",
urls = ["https://github.com/keith/buildifier-prebuilt/archive/6.3.3.tar.gz"],
sha256 = "8ada9d88e51ebf5a1fdff37d75ed41d51f5e677cdbeafb0a22dda54747d6e07e",
strip_prefix = "buildifier-prebuilt-6.4.0",
urls = ["http://github.com/keith/buildifier-prebuilt/archive/6.4.0.tar.gz"],
)

http_archive(
name = "aspect_rules_lint",
sha256 = "604666ec7ffd4f5f2636001ae892a0fbc29c77401bb33dd10601504e3ba6e9a7",
strip_prefix = "rules_lint-0.6.1",
url = "https://github.com/aspect-build/rules_lint/releases/download/v0.6.1/rules_lint-v0.6.1.tar.gz",
sha256 = "98bed74aff6498ea9b58ff36db27a952c7a1b53764171c5d0d29ef0c61ffc4fb",
strip_prefix = "rules_lint-0.11.0",
url = "https://github.com/aspect-build/rules_lint/releases/download/v0.11.0/rules_lint-v0.11.0.tar.gz",
)

aspect_workflows_github_actions_deps()
4 changes: 2 additions & 2 deletions jasmine/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def jasmine_test(
name = name,
config = config,
enable_runfiles = select({
"@aspect_rules_js//js/private:enable_runfiles": True,
"@aspect_rules_js//js:enable_runfiles": True,
"//conditions:default": False,
}),
unresolved_symlinks_enabled = select({
"@aspect_rules_js//js/private:experimental_allow_unresolved_symlinks": True,
"@aspect_rules_js//js:allow_unresolved_symlinks": True,
"//conditions:default": False,
}),
entry_point = entry_point,
Expand Down
Loading
Loading