-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add buildifier to lint bazel files (#9909)
- Loading branch information
Showing
5 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Buildifier | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**/*.bzl' | ||
- '**/*.bazel' | ||
- 'BUILD*' | ||
- 'WORKSPACE*' | ||
push: | ||
paths: | ||
- '**/*.bzl' | ||
- '**/*.bazel' | ||
- 'BUILD*' | ||
- 'WORKSPACE*' | ||
branches: | ||
- master | ||
- release/* | ||
|
||
jobs: | ||
|
||
autoformat: | ||
name: Auto-format and Check | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo wget -O /bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/5.1.0/buildifier-linux-amd64 | ||
sudo chmod +x /bin/buildifier | ||
- name: Run buildifier | ||
run: | | ||
buildifier -mode=fix $(find . -name 'BUILD*' -o -name 'WORKSPACE*' -o -name '*.bzl' -o -name '*.bazel' -type f) | ||
- name: Verify buildifier | ||
shell: bash | ||
run: | | ||
# From: https://backreference.org/2009/12/23/how-to-match-newlines-in-sed/ | ||
# This is to leverage this workaround: | ||
# https://github.com/actions/toolkit/issues/193#issuecomment-605394935 | ||
function urlencode() { | ||
sed ':begin;$!N;s/\n/%0A/;tbegin' | ||
} | ||
if [[ $(git diff-index --name-only HEAD --) ]]; then | ||
for x in $(git diff-index --name-only HEAD --); do | ||
echo "::error file=$x::Please run buildifier.%0A$(git diff $x | urlencode)" | ||
done | ||
echo "${{ github.repository }} is out of style. Please run buildifier." | ||
exit 1 | ||
fi | ||
echo "${{ github.repository }} is formatted correctly." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
workspace(name = "kong") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", | ||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", | ||
], | ||
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", | ||
) | ||
|
||
load("//build:kong_bindings.bzl", "load_bindings") | ||
|
||
load_bindings(name = "kong_bindings") | ||
|
||
load("//build/openresty:repositories.bzl", "openresty_repositories") | ||
|
||
openresty_repositories() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a59deae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available kong/kong:a59deaeb6201099d34f21045f1a0f2d29dda0cf9
Artifacts available https://github.com/Kong/kong/actions/runs/3646051885
a59deae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker image available kong/kong:master-apk
Artifacts avaialble https://github.com/Kong/kong/actions/runs/3646051885
a59deae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker image available kong/kong:master-deb
Artifacts avaialble https://github.com/Kong/kong/actions/runs/3646051885
a59deae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker image available kong/kong:master-rpm
Artifacts avaialble https://github.com/Kong/kong/actions/runs/3646051885