Skip to content

Commit b5e8cd4

Browse files
authored
chore: bzlmod (#113)
* chore: bzlmod * chore: bump minimum rules_js to pick up windows fix * format * green up root bzlmod * exclude buildifier on windows
1 parent e7c1047 commit b5e8cd4

28 files changed

+114
-8
lines changed

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Take care to document any settings that you expect users to apply.
33
# Settings that apply only to CI are in .github/workflows/ci.bazelrc
44

5+
# for rules_js
6+
build --enable_runfiles
57

68
# Load any settings specific to the current user.
79
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members

.bcr/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Bazel Central Registry
2+
3+
When the ruleset is released, we want it to be published to the
4+
Bazel Central Registry automatically:
5+
<https://registry.bazel.build>
6+
7+
This folder contains configuration files to automate the publish step.
8+
See <https://github.com/bazel-contrib/publish-to-bcr/blob/main/templates/README.md>
9+
for authoritative documentation about these files.

.bcr/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# See https://github.com/bazel-contrib/publish-to-bcr#a-note-on-release-automation
2+
fixedReleaser:
3+
login: gregmagolan
4+

.bcr/metadata.template.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"homepage": "https://docs.aspect.build/rules/aspect_rules_webpack",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "aspect-build",
7+
"name": "Aspect team"
8+
}
9+
],
10+
"repository": ["github:aspect-build/rules_webpack"],
11+
"versions": [],
12+
"yanked_versions": {}
13+
}

.bcr/presubmit.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bcr_test_module:
2+
module_path: 'e2e/smoke'
3+
matrix:
4+
platform: ['debian10', 'macos', 'ubuntu2004', 'windows']
5+
tasks:
6+
run_tests:
7+
name: 'Run test module'
8+
platform: ${{ platform }}
9+
test_targets:
10+
- '//...'

.bcr/source.template.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "**leave this alone**",
3+
"strip_prefix": "{REPO}-{VERSION}",
4+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_webpack-{TAG}.tar.gz"
5+
}

.github/workflows/ci.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ jobs:
4242
run: echo "os=macos-latest" >> $GITHUB_OUTPUT
4343
# Only run on main branch (not PRs) to minimize macOS minutes (billed at 10X)
4444
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
45-
if: ${{ github.ref == 'refs/heads/main' }}
45+
if: github.ref == 'refs/heads/main'
46+
- id: windows
47+
run: echo "os=windows-latest" >> $GITHUB_OUTPUT
48+
# Only run on main branch (or PR branches that contain 'windows') to minimize Windows minutes (billed at 2X)
49+
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
50+
if: github.ref == 'refs/heads/main' || contains(github.head_ref, 'windows') || github.head_ref == 'bzlmod'
4651
outputs:
4752
# Will look like ["ubuntu-latest", "macos-latest"]
4853
os: ${{ toJSON(steps.*.outputs.os) }}
@@ -59,17 +64,27 @@ jobs:
5964
fail-fast: false
6065
matrix:
6166
os: ${{ fromJSON(needs.matrix-prep-os.outputs.os) }}
67+
bzlmodEnabled: [true, false]
6268
bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }}
6369
folder:
6470
- '.'
6571
- 'e2e/loaders'
66-
- 'e2e/workspace'
72+
- 'e2e/smoke'
6773
- 'e2e/worker'
6874
exclude:
6975
# Don't test macos with Bazel 5 to minimize macOS minutes (billed at 10X)
7076
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
7177
- os: macos-latest
7278
bazelversion: 5.3.2
79+
# Don't test bzlmod with Bazel 5 (not supported)
80+
- bazelversion: 5.3.2
81+
bzlmodEnabled: true
82+
# TODO
83+
- folder: e2e/loaders
84+
bzlmodEnabled: true
85+
# TODO
86+
- folder: e2e/worker
87+
bzlmodEnabled: true
7388

7489
# Steps represent a sequence of tasks that will be executed as part of the job
7590
steps:
@@ -103,12 +118,19 @@ jobs:
103118
# then use .bazelversion to determine which Bazel version to use
104119
run: echo "${{ matrix.bazelversion }}" > .bazelversion
105120

121+
- name: Set bzlmod flag
122+
# Store the --enable_bzlmod flag that we add to the test command below
123+
# only when we're running bzlmod in our test matrix.
124+
id: set_bzlmod_flag
125+
if: matrix.bzlmodEnabled
126+
run: echo "bzlmod_flag=--enable_bzlmod" >> $GITHUB_OUTPUT
127+
106128
- name: bazel test //...
107129
env:
108130
# Bazelisk will download bazel to here, ensure it is cached between runs.
109131
XDG_CACHE_HOME: ~/.cache/bazel-repo
110132
working-directory: ${{ matrix.folder }}
111-
run: bazel --bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
133+
run: bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc --bazelrc=.bazelrc test ${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} //...
112134

113135
- name: run ./test.sh
114136
working-directory: ${{ matrix.folder }}

.github/workflows/release_prep.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ http_archive(
2323
)
2424
EOF
2525

26-
awk 'f;/--SNIP--/{f=1}' e2e/workspace/WORKSPACE
26+
awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel
2727
echo "\`\`\`"

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ buildifier(
2323
],
2424
lint_mode = "warn",
2525
mode = "diff",
26+
tags = ["manual"], # tag as manual so windows ci does not build it by default
2627
)
2728

2829
bzl_library(

MODULE.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"aspect-build/rules_webpack"
2+
3+
module(
4+
name = "aspect_rules_webpack",
5+
version = "0.0.0",
6+
compatibility_level = 1,
7+
)
8+
9+
bazel_dep(name = "aspect_bazel_lib", version = "1.32.0")
10+
bazel_dep(name = "aspect_rules_js", version = "1.29.2")
11+
bazel_dep(name = "bazel_skylib", version = "1.4.1")
12+
13+
bazel_dep(name = "gazelle", version = "0.29.0", dev_dependency = True, repo_name = "bazel_gazelle")
14+
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
15+
bazel_dep(name = "buildifier_prebuilt", version = "6.1.2.1", dev_dependency = True)

0 commit comments

Comments
 (0)