Skip to content

Commit 5d0c622

Browse files
authored
chore: run bzlmod on ci (#523)
1 parent c74db34 commit 5d0c622

File tree

9 files changed

+111
-1
lines changed

9 files changed

+111
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
os: ${{ fromJSON(needs.matrix-prep-os.outputs.os) }}
7979
config: ${{ fromJSON(needs.matrix-prep-config.outputs.configs) }}
8080
bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }}
81+
bzlmodEnabled: [true, false]
8182
folder:
8283
- '.'
8384
- 'e2e/bzlmod'
@@ -95,6 +96,11 @@ jobs:
9596
# TODO(https://github.com/aspect-build/rules_ts/issues/432): re-enable
9697
- folder: e2e/bzlmod
9798
config: rbe
99+
# TODO: combine bzlmod and workspace into a single 'smoke' e2e
100+
- folder: e2e/bzlmod
101+
bzlmodEnabled: false
102+
- folder: e2e/workspace
103+
bzlmodEnabled: true
98104

99105
# Steps represent a sequence of tasks that will be executed as part of the job
100106
steps:
@@ -128,6 +134,13 @@ jobs:
128134
# then use .bazelversion to determine which Bazel version to use
129135
run: echo "${{ matrix.bazelversion }}" > .bazelversion
130136

137+
- name: Set bzlmod flag
138+
# Store the --enable_bzlmod flag that we add to the test command below
139+
# only when we're running bzlmod in our test matrix.
140+
id: set_bzlmod_flag
141+
if: matrix.bzlmodEnabled
142+
run: echo "bzlmod_flag=--enable_bzlmod" >> $GITHUB_OUTPUT
143+
131144
- name: Write RBE credentials
132145
if: ${{ matrix.config == 'rbe' }}
133146
working-directory: ${{ matrix.folder }}
@@ -143,7 +156,13 @@ jobs:
143156
# Bazelisk will download bazel to here, ensure it is cached between runs.
144157
XDG_CACHE_HOME: ~/.cache/bazel-repo
145158
working-directory: ${{ matrix.folder }}
146-
run: bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test --config=${{ matrix.config }} //...
159+
run: |
160+
bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc \
161+
--bazelrc=.bazelrc \
162+
test \
163+
--config=${{ matrix.config }} \
164+
//... \
165+
${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }}
147166
148167
test-worker:
149168
runs-on: ubuntu-latest

MODULE.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ bazel_dep(name = "buildifier_prebuilt", version = "6.0.0.1", dev_dependency = Tr
2424
bazel_dep(name = "rules_nodejs", version = "5.8.2", dev_dependency = True)
2525
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
2626
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
27+
bazel_dep(name = "aspect_rules_lint", version = "0.9.1", dev_dependency = True)
28+
bazel_dep(name = "rules_go", version = "0.35.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
2729

2830
npm = use_extension(
2931
"@aspect_rules_js//npm:extensions.bzl",
@@ -44,3 +46,7 @@ rules_ts_ext = use_extension(
4446
)
4547
rules_ts_ext.deps(ts_version_from = "//examples:package.json")
4648
use_repo(rules_ts_ext, "npm_typescript")
49+
50+
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk", dev_dependency = True)
51+
go_sdk.download()
52+
use_repo(go_sdk, go_sdk = "go_default_sdk")

WORKSPACE.bzlmod

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
load("//.github/workflows:deps.bzl", "aspect_workflows_github_actions_deps")
22

33
aspect_workflows_github_actions_deps()
4+
5+
# TODO: rules_lint doesn't have a way to bring deps in under bzlmod
6+
load(
7+
"@aspect_rules_lint//format:repositories.bzl",
8+
"fetch_shfmt",
9+
"fetch_terraform",
10+
)
11+
12+
fetch_shfmt()
13+
14+
fetch_terraform()

e2e/external_dep/MODULE.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module(
2+
version = "0.0.0",
3+
compatibility_level = 1,
4+
)
5+
6+
bazel_dep(name = "bazel_skylib", version = "1.4.2")
7+
bazel_dep(name = "aspect_rules_ts", version = "0.0.0")
8+
local_path_override(
9+
module_name = "aspect_rules_ts",
10+
path = "../..",
11+
)
12+
13+
rules_ts_ext = use_extension(
14+
"@aspect_rules_ts//ts:extensions.bzl",
15+
"ext",
16+
dev_dependency = True,
17+
)
18+
rules_ts_ext.deps()
19+
use_repo(rules_ts_ext, "npm_typescript")

e2e/external_dep/WORKSPACE.bzlmod

Whitespace-only changes.

e2e/external_dep/app/MODULE.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module(
2+
version = "0.0.0",
3+
compatibility_level = 1,
4+
)
5+
6+
bazel_dep(name = "bazel_skylib", version = "1.4.1")
7+
bazel_dep(name = "aspect_rules_ts", version = "0.0.0")
8+
local_path_override(
9+
module_name = "aspect_rules_ts",
10+
path = "../../..",
11+
)
12+
13+
rules_ts_ext = use_extension(
14+
"@aspect_rules_ts//ts:extensions.bzl",
15+
"ext",
16+
dev_dependency = True,
17+
)
18+
rules_ts_ext.deps()
19+
use_repo(rules_ts_ext, "npm_typescript")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
local_repository(
2+
name = "lib_wksp",
3+
path = "..",
4+
)

e2e/worker/MODULE.bazel

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module(
2+
version = "0.0.0",
3+
compatibility_level = 1,
4+
)
5+
6+
bazel_dep(name = "bazel_skylib", version = "1.4.1")
7+
bazel_dep(name = "aspect_bazel_lib", version = "1.38.1")
8+
bazel_dep(name = "aspect_rules_js", version = "1.34.0")
9+
bazel_dep(name = "aspect_rules_ts", version = "0.0.0")
10+
local_path_override(
11+
module_name = "aspect_rules_ts",
12+
path = "../..",
13+
)
14+
15+
rules_ts_ext = use_extension(
16+
"@aspect_rules_ts//ts:extensions.bzl",
17+
"ext",
18+
dev_dependency = True,
19+
)
20+
rules_ts_ext.deps()
21+
use_repo(rules_ts_ext, "npm_typescript")
22+
23+
npm = use_extension(
24+
"@aspect_rules_js//npm:extensions.bzl",
25+
"npm",
26+
dev_dependency = True,
27+
)
28+
npm.npm_translate_lock(
29+
name = "npm",
30+
pnpm_lock = "//:pnpm-lock.yaml",
31+
)
32+
use_repo(npm, "npm")

e2e/worker/WORKSPACE.bzlmod

Whitespace-only changes.

0 commit comments

Comments
 (0)