Skip to content

Commit b0ea3cd

Browse files
authored
chore(ci): enable buildifier check (#480)
1 parent f853cb0 commit b0ea3cd

File tree

37 files changed

+155
-112
lines changed

37 files changed

+155
-112
lines changed

.aspect/workflows/bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
common --config=ci
2+
13
# build without the bytes
24
common --remote_download_outputs=minimal
35
common --nobuild_runfile_links

.aspect/workflows/config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# See https://docs.aspect.build/workflows/configuration
22
tasks:
3-
- gazelle:
43
- checkout:
54
update_strategy: rebase
5+
- gazelle:
6+
- buildifier:
67
- lint:
78
- format:
89
- test:

.bazelrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ common --check_direct_dependencies=off
1111
common --workspace_status_command=githooks/check-config.sh
1212
# But not on CI.
1313
common:ci --workspace_status_command=
14-
# Placeholder for your actual stamping logic
15-
build:release --workspace_status_command='echo BUILD_VERSION v1.2.3'
1614

1715
# 'bazel build --config=lint' will produce the linter reports.
1816
build:lint --aspects=//tools/lint:linters.bzl%buf

.bazelversion

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
8.2.0
2-
3-
# The first line of this file is the version of Bazel that Bazelisk will
4-
# download. We use the latest version of Bazel because we rely on strong testing
5-
# the Bazel team performs on every LTS release.
6-
7-
# More about Bazel's Long-Term Support model: https://bazel.build/release
1+
8.4.2

.circleci/config.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ workflows:
1616
requires:
1717
- aw-test
1818
workspace: .
19+
- aw-buildifier:
20+
context: []
21+
workspace: .
1922
- aw-format:
2023
context: []
2124
workspace: .
@@ -102,6 +105,50 @@ jobs:
102105
name: Delivery
103106
no_output_timeout: 180m
104107
working_directory: /mnt/ephemeral/workdir
108+
aw-buildifier:
109+
environment:
110+
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
111+
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type >>
112+
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
113+
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
114+
ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >>
115+
XDG_CACHE_HOME: /mnt/ephemeral/caches
116+
machine: true
117+
parameters:
118+
delivery_manifest:
119+
default: true
120+
type: boolean
121+
workspace:
122+
type: string
123+
resource_class: aspect-build/aspect-default
124+
steps:
125+
- run:
126+
command: /etc/aspect/workflows/bin/configure_workflows_env
127+
name: Workflows environment
128+
- checkout
129+
- run:
130+
command: rm -rf /workflows/artifacts /workflows/testlogs
131+
name: Prepare archive directories
132+
- run:
133+
command: /etc/aspect/workflows/bin/agent_health_check
134+
name: Agent health check
135+
no_output_timeout: 180m
136+
- run:
137+
command: rosetta run checkout
138+
name: Checkout health
139+
no_output_timeout: 180m
140+
- run:
141+
command: rosetta run buildifier --workspace << parameters.workspace >>
142+
name: Buildifier
143+
no_output_timeout: 180m
144+
- store_artifacts:
145+
path: /workflows/artifacts
146+
- run:
147+
command: rosetta run finalization
148+
name: Finalization
149+
no_output_timeout: 10m
150+
when: always
151+
working_directory: /mnt/ephemeral/workdir
105152
aw-format:
106153
environment:
107154
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>

BUILD.bazel

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@aspect_rules_js//js:defs.bzl", "js_library")
2+
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
23
load("@gazelle//:def.bzl", "gazelle")
34
load("@npm//:defs.bzl", "npm_link_all_packages")
45

@@ -76,3 +77,25 @@ alias(
7677
actual = "//tools/format:format",
7778
visibility = ["//visibility:public"],
7879
)
80+
81+
buildifier(
82+
name = "buildifier",
83+
exclude_patterns = ["./.git/*"],
84+
lint_mode = "fix",
85+
mode = "fix",
86+
)
87+
88+
# todo(team): burn down to zero
89+
DISABLED_BUILDIFIER_WARNINGS = [
90+
"module-docstring",
91+
"function-docstring",
92+
"unused-variable",
93+
]
94+
95+
buildifier(
96+
name = "buildifier.check",
97+
exclude_patterns = ["./.git/*"],
98+
lint_mode = "warn",
99+
lint_warnings = ["-{}".format(w) for w in DISABLED_BUILDIFIER_WARNINGS],
100+
mode = "diff",
101+
)

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bazel_dep(name = "googletest", version = "1.15.2")
2222
bazel_dep(name = "platforms", version = "0.0.10")
2323
bazel_dep(name = "rules_angular", version = "0.1.0")
2424
bazel_dep(name = "rules_apple", version = "3.0.0")
25-
bazel_dep(name = "rules_buf", version = "0.3.0")
25+
bazel_dep(name = "rules_buf", version = "0.5.2")
2626
bazel_dep(name = "rules_cc", version = "0.1.1")
2727
bazel_dep(name = "rules_go", version = "0.56.1")
2828
bazel_dep(name = "rules_java", version = "8.6.1")

WORKSPACE.bazel

Lines changed: 0 additions & 3 deletions
This file was deleted.

angular-ngc/WORKSPACE.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ npm_translate_lock(
4848
custom_postinstalls = {
4949
"ng2-dragula": "ngcc --source .",
5050
},
51+
npmrc = "//:.npmrc",
52+
pnpm_lock = "//:pnpm-lock.yaml",
5153
# Workaround https://github.com/sass/dart-sass/issues/1765
5254
# See comments in sass_workaround.bzl
5355
public_hoist_packages = {p: ["packages/lib-a"] for p in SASS_DEPS},
54-
npmrc = "//:.npmrc",
55-
pnpm_lock = "//:pnpm-lock.yaml",
5656
verify_node_modules_ignored = "//:.bazelignore",
5757
)
5858

@@ -73,6 +73,7 @@ http_archive(
7373
)
7474

7575
v2_branch_head = "e5932f883443233f42b61d3fb87b2287518fbcba"
76+
7677
http_archive(
7778
name = "aspect_rules_ts",
7879
#sha256 = "ace5b609603d9b5b875d56c9c07182357c4ee495030f40dcefb10d443ba8c208",

angular-ngc/defs.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
load("@bazel_skylib//rules:write_file.bzl", "write_file")
2-
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
31
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
42
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
3+
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
4+
load("@bazel_skylib//rules:write_file.bzl", "write_file")
55
load("@npm//:history-server/package_json.bzl", history_server_bin = "bin")
66
load("@npm//:html-insert-assets/package_json.bzl", html_insert_assets_bin = "bin")
77
load("@npm//:karma/package_json.bzl", _karma_bin = "bin")
8+
load("//tools:karma.bzl", "generate_karma_config", "generate_test_bootstrap", "generate_test_setup")
89
load("//tools:ng.bzl", "ng_esbuild", "ng_project")
910
load("//tools:ts.bzl", "ts_project")
10-
load("//tools:karma.bzl", "generate_karma_config", "generate_test_bootstrap", "generate_test_setup")
1111

1212
# Common dependencies of Angular applications
1313
APPLICATION_DEPS = [

0 commit comments

Comments
 (0)