Skip to content

Commit

Permalink
chore: check buildifier on CI
Browse files Browse the repository at this point in the history
Matches how it's done in the bazel-contrib/rules-template
  • Loading branch information
alexeagle authored and p0deje committed Nov 18, 2023
1 parent cde1167 commit 772d4eb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

buildifier(
name = "buildifier.check",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
)
19 changes: 19 additions & 0 deletions .github/workflows/buildifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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@v4
- name: buildifier
run: bazel run //.github/workflows:buildifier.check
18 changes: 18 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ http_archive(
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")

stardoc_repositories()

# Buildifier, used in CI to verify BUILD/.bzl files are formatted and linted
http_archive(
name = "buildifier_prebuilt",
sha256 = "72b5bb0853aac597cce6482ee6c62513318e7f2c0050bc7c319d75d03d8a3875",
strip_prefix = "buildifier-prebuilt-6.3.3",
urls = [
"http://github.com/keith/buildifier-prebuilt/archive/6.3.3.tar.gz",
],
)

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

buildifier_prebuilt_deps()

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

buildifier_prebuilt_register_toolchains()

0 comments on commit 772d4eb

Please sign in to comment.