Skip to content

Commit 7a71042

Browse files
authored
chore: test on bazel 9 (#3880)
Requires adapting to the Bazel 9 breaking changes (finally)
1 parent f1344d6 commit 7a71042

File tree

28 files changed

+117
-58
lines changed

28 files changed

+117
-58
lines changed

.aspect/workflows/config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1+
# Test the root workspace using "dev dependencies" on Linux only, and with the version in .bazelversion.
2+
# Look in /.github/workflows/ci.yaml for test matrix on other OS
13
# See https://docs.aspect.build/workflows/configuration
24
tasks:
35
- test:
6+
name: Bazel 7
7+
id: bazel-7
8+
env:
9+
USE_BAZEL_VERSION: 7.x
10+
- test:
11+
name: Bazel 8
12+
id: bazel-8
13+
env:
14+
USE_BAZEL_VERSION: 8.x
15+
- test:
16+
name: Bazel 9
17+
id: bazel-9
18+
env:
19+
USE_BAZEL_VERSION: 9.*
420
notifications:
521
github: {}

.bcr/presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bcr_test_module:
22
module_path: "e2e/smoke"
33
matrix:
4-
bazel: ["7.x", "8.x", "rolling"]
4+
bazel: ["7.x", "8.x", "9.*"]
55
platform: ["debian11", "macos", "ubuntu2204", "windows"]
66
tasks:
77
run_tests:

.github/workflows/ci.yaml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
name: CI
2-
3-
# Controls when the action will run.
42
on:
53
push:
64
branches: [main]
75
pull_request:
86
branches: [main]
97
# Allows you to run this workflow manually from the Actions tab
108
workflow_dispatch:
11-
12-
concurrency:
13-
# Cancel previous actions from the same PR or branch except 'main' branch.
14-
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
15-
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
16-
cancel-in-progress: ${{ github.ref_name != 'main' }}
17-
9+
permissions:
10+
contents: read
1811
jobs:
19-
test:
20-
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v7.2.3
21-
with:
22-
folders: '[".", "e2e/headers", "e2e/smoke", "e2e/nodejs_host", "e2e/conflicting_toolchains"]'
23-
# stardoc generated docs fail on diff_test with Bazel 6.4.0 so don't test against it in root repository
24-
exclude: |
25-
[
26-
{"bazelversion": "7.3.1", "os": "ubuntu-latest", folder: "."},
27-
{"bazelversion": "6.4.0", "os": "macos-latest"},
28-
{"bazelversion": "6.4.0", "os": "windows-latest"},
29-
{"bazelversion": "6.4.0", folder: "."},
30-
{"bazelversion": "6.4.0", bzlmodEnabled: true},
31-
{folder: "e2e/conflicting_toolchains", bzlmodEnabled: false}
32-
]
12+
e2e-tests:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
bazel:
18+
- 9.*
19+
folder:
20+
- e2e/headers
21+
- e2e/smoke
22+
- e2e/nodejs_host
23+
- e2e/conflicting_toolchains
24+
steps:
25+
- uses: actions/checkout@v5
26+
- uses: bazel-contrib/setup-bazel@0.18.0
27+
- run: bazel test ...
28+
env:
29+
USE_BAZEL_VERSION: ${{ matrix.bazel }}
30+
working-directory: ${{ matrix.folder }}

MODULE.bazel

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ module(
66
)
77

88
# Lower-bounds (minimum) versions for direct runtime dependencies
9-
bazel_dep(name = "bazel_lib", version = "3.0.0-beta.1")
9+
bazel_dep(name = "bazel_lib", version = "3.0.0")
10+
bazel_dep(name = "bazel_features", version = "1.39.0")
1011
bazel_dep(name = "bazel_skylib", version = "1.4.1")
11-
bazel_dep(name = "platforms", version = "0.0.5")
12+
bazel_dep(name = "platforms", version = "1.0.0")
13+
bazel_dep(name = "rules_cc", version = "0.2.16") # to expose headers
1214

1315
# workaround for https://github.com/bazelbuild/bazel/issues/25124
1416
bazel_dep(name = "zlib", version = "1.3.1.bcr.6", dev_dependency = True)
@@ -56,3 +58,25 @@ register_toolchains("@nodejs_toolchains//:windows_amd64_toolchain")
5658
register_toolchains("@nodejs_toolchains//:windows_arm64_runtime_toolchain")
5759

5860
register_toolchains("@nodejs_toolchains//:windows_arm64_toolchain")
61+
62+
############
63+
# Dev dependencies
64+
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.1", dev_dependency = True)
65+
66+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
67+
68+
http_archive(
69+
name = "npm_typescript",
70+
build_file = "//:external/typescript.BUILD",
71+
dev_dependency = True,
72+
sha256 = "6e2faae079c9047aa921e8a307f0cec0da4dc4853e20bb31d18acc678f5bf505",
73+
urls = ["https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz"],
74+
)
75+
76+
http_archive(
77+
name = "npm_types_node",
78+
build_file = "//:external/types_node.BUILD",
79+
dev_dependency = True,
80+
sha256 = "6ef16adadc11a80601c023e1271887425c5c5c1867266d35493c7e92d7cc00fa",
81+
urls = ["https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz"],
82+
)

WORKSPACE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ workspace(name = "rules_nodejs")
1616

1717
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1818

19+
http_archive(
20+
name = "bazel_features",
21+
sha256 = "5ab1a90d09fd74555e0df22809ad589627ddff263cff82535815aa80ca3e3562",
22+
strip_prefix = "bazel_features-1.39.0",
23+
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.39.0/bazel_features-v1.39.0.tar.gz",
24+
)
25+
26+
load("@bazel_features//:deps.bzl", "bazel_features_deps")
27+
28+
bazel_features_deps()
29+
1930
#
2031
# Install rules_nodejs dev dependencies
2132
#

e2e/conflicting_toolchains/.bazelversion

Lines changed: 0 additions & 1 deletion
This file was deleted.

e2e/conflicting_toolchains/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# this is set up to make bazel test //... pass
22
load("@bazel_skylib//rules:write_file.bzl", "write_file")
3+
load("@rules_shell//shell:sh_test.bzl", "sh_test")
34

45
write_file(
56
name = "empty",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# this is set up to make bazel test //... pass
2-
bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)
1+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
2+
bazel_dep(name = "rules_shell", version = "0.6.1")

e2e/conflicting_toolchains/test_include_headers/.bazelversion

Lines changed: 0 additions & 1 deletion
This file was deleted.

e2e/conflicting_toolchains/test_include_headers/MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
bazel_dep(name = "rules_nodejs", version = "0.0.0", dev_dependency = True)
1+
bazel_dep(name = "rules_nodejs")
22
local_path_override(
33
module_name = "rules_nodejs",
44
path = "../../..",
55
)
66

7-
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)
7+
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
88
node.toolchain(
99
name = "mynode",
1010
)

0 commit comments

Comments
 (0)