Skip to content
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
6 changes: 0 additions & 6 deletions .aspect/cli/config.yaml

This file was deleted.

32 changes: 32 additions & 0 deletions .aspect/config.axl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Aspect CLI configuration."""

load("@aspect//feature/artifacts.axl", "ArtifactUpload")
load("@aspect//traits.axl", "BazelTrait")
load("@aspect//format.axl", "format")

# `aspect buildifier` — alias of `aspect format` preset to the Starlark-only
# formatter target. CI and local users can run `aspect buildifier` instead
# of `aspect format --formatter-target=//tools/format:buildifier`.
buildifier = format.alias(
defaults = {
"formatter_target": "//tools/format:buildifier",
},
summary = "Format Starlark files using buildifier.",
)

def config(ctx: ConfigContext):
is_ci = bool(ctx.std.env.var("CI"))

if is_ci:
ctx.traits[BazelTrait].extra_flags.extend([
"--config=ci",
])

# Register the buildifier alias as a real CLI command.
ctx.tasks.add(buildifier)

# Enable artifact uploads for testlogs, profile, and BEP.
# upload_test_logs="failed" — only the logs from failing tests are useful.
ctx.features[ArtifactUpload].args.upload_test_logs = "failed"
ctx.features[ArtifactUpload].args.upload_profile = True
ctx.features[ArtifactUpload].args.upload_bep = True
1 change: 1 addition & 0 deletions .aspect/version.axl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version("2026.21.30")
3 changes: 0 additions & 3 deletions .aspect/workflows/bazelrc

This file was deleted.

31 changes: 0 additions & 31 deletions .aspect/workflows/config.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import %workspace%/tools/preset.bazelrc

common --config=ruleset

# Build without the bytes
common:ci --remote_download_outputs=minimal
common:ci --nobuild_runfile_links

# Override the preset's `--lockfile_mode=error` on CI since we don't
# yet commit MODULE.bazel.lock — see .gitignore.
common:ci --lockfile_mode=off
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
20 changes: 0 additions & 20 deletions .github/workflows/buildifier.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: CI
# Controls when the action will run.
name: CI - Vanilla Bazel
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
# Cancel previous actions from the same PR or branch except 'main' branch.
# 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.
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) || ''}}
cancel-in-progress: ${{ github.ref_name != 'main' }}
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Prepares dynamic test matrix values
matrix-prep:
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/ci-workflows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI - Aspect Workflows
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
id-token: write
env:
ASPECT_API_TOKEN: ${{ secrets.ASPECT_API_TOKEN }}
# Pin the version of aspect-launcher to install to avoid GitHub API rate limiting from `latest` lookups in CI.
INSTALL_ASPECT_LAUNCHER_VERSION: 2026.21.21
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-test-root
repository-cache: true
external-cache: true
- name: Test
run: |
curl -fsSL https://install.aspect.build | bash -s -- "$INSTALL_ASPECT_LAUNCHER_VERSION"
aspect test --task-key=test -- //...
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-format-root
repository-cache: true
external-cache: true
- name: Format
run: |
curl -fsSL https://install.aspect.build | bash -s -- "$INSTALL_ASPECT_LAUNCHER_VERSION"
aspect format --task-key=format
buildifier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-buildifier-root
repository-cache: true
external-cache: true
- name: Buildifier
run: |
curl -fsSL https://install.aspect.build | bash -s -- "$INSTALL_ASPECT_LAUNCHER_VERSION"
aspect buildifier --task-key=buildifier
test-e2e-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-test-e2e-smoke
repository-cache: true
external-cache: true
- name: Test (e2e/smoke)
working-directory: e2e/smoke
run: |
curl -fsSL https://install.aspect.build | bash -s -- "$INSTALL_ASPECT_LAUNCHER_VERSION"
aspect test --task-key=test-e2e-smoke -- //...
gazelle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-gazelle-root
repository-cache: true
external-cache: true
- name: Gazelle
run: |
curl -fsSL https://install.aspect.build | bash -s -- "$INSTALL_ASPECT_LAUNCHER_VERSION"
aspect gazelle --task-key=gazelle
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
bazel-*
.bazelrc.user
node_modules/
.pnpm-*

Expand Down
21 changes: 5 additions & 16 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@npm//:defs.bzl", "npm_link_all_packages")

npm_link_all_packages(name = "node_modules")

buildifier(
name = "buildifier",
exclude_patterns = ["./.git/*"],
lint_mode = "fix",
mode = "fix",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)

buildifier(
name = "buildifier.check",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
alias(
name = "format",
actual = "//tools/format",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)

alias(
name = "format",
actual = "//tools/format",
name = "buildifier",
actual = "//tools/format:buildifier",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use_repo(tel, "aspect_tools_telemetry_report")

####### Dev dependencies ########

bazel_dep(name = "aspect_gazelle_prebuilt", version = "0.0.11", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "1.0.0-rc9", dev_dependency = True)
bazel_dep(name = "bazelrc-preset.bzl", version = "1.1.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Bazel rules for terser

> [!NOTE]
> This repository uses the [Aspect CLI](https://github.com/aspect-build/aspect-cli) for CI and local development.
> See the [docs](https://docs.aspect.build/cli/overview) and [install instructions](https://docs.aspect.build/cli/install) to get started.

[terser](https://terser.org/) is a JavaScript minifier.

These rules teach Bazel how to interact with the [terser CLI](https://terser.org/docs/cli-usage).
Expand Down
12 changes: 10 additions & 2 deletions tools/format/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
load("@aspect_rules_lint//format:defs.bzl", "format_multirun")

package(default_visibility = ["//:__subpackages__"])

format_multirun(
name = "format",
go = "@aspect_rules_lint//format:gofumpt",
shell = "@aspect_rules_lint//format:shfmt",
starlark = "@buildifier_prebuilt//:buildifier",
tags = ["manual"],
visibility = ["//:__subpackages__"],
yaml = "@aspect_rules_lint//format:yamlfmt",
)

# Starlark-only formatter for the dedicated buildifier CI step.
# See https://docs.aspect.build/cli/migration/buildifier.
format_multirun(
name = "buildifier",
starlark = "@buildifier_prebuilt//:buildifier",
tags = ["manual"],
)
8 changes: 8 additions & 0 deletions tools/gazelle/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@aspect_gazelle_prebuilt//:def.bzl", "aspect_gazelle")

package(default_visibility = ["//:__subpackages__"])

aspect_gazelle(
name = "gazelle",
languages = ["js"],
)
Loading