Skip to content

Commit

Permalink
ci: enable buildifier check on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Jun 9, 2023
1 parent 0a7ed57 commit 3ff99e2
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/buildifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Buildifier

# Controls when the action will run.
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:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: buildifier
run: bazel run //:buildifier.check
# TODO: bzlmod
# run: bazel run --enable_bzlmod //:buildifier.check
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

gazelle_binary(
name = "gazelle_bin",
Expand All @@ -11,6 +12,15 @@ gazelle(
gazelle = "gazelle_bin",
)

buildifier(
name = "buildifier.check",
exclude_patterns = [
"./.git/*",
],
lint_mode = "warn",
mode = "diff",
)

bzl_library(
name = "internal_deps",
srcs = ["internal_deps.bzl"],
Expand Down
9 changes: 9 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ npm_translate_lock(
load("@npm//:repositories.bzl", "npm_repositories")

npm_repositories()

# Buildifier
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

buildifier_prebuilt_deps()

load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")

buildifier_prebuilt_register_toolchains()
9 changes: 9 additions & 0 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,12 @@ def rules_cypress_internal_deps():
"https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F" + CHROME_REVISION_LINUX + "%2Fchrome-linux.zip?alt=media",
],
)

http_archive(
name = "buildifier_prebuilt",
sha256 = "e46c16180bc49487bfd0f1ffa7345364718c57334fa0b5b67cb5f27eba10f309",
strip_prefix = "buildifier-prebuilt-6.1.0",
urls = [
"https://github.com/keith/buildifier-prebuilt/archive/6.1.0.tar.gz",
],
)

0 comments on commit 3ff99e2

Please sign in to comment.