Skip to content

Commit

Permalink
ci/buildifier: Install and run with bazel
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
phlax committed Mar 21, 2024
1 parent 9be9637 commit 68fc084
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.0
5.4.0
13 changes: 3 additions & 10 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v2
with:
go-version: '^1.16'

- name: Install dependencies
run: |
go install github.com/bazelbuild/buildtools/buildifier@latest
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Format (buildifier)
run: find . -name "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -n1 buildifier -mode=check
run: |
BAZEL_FILES="$(find . -name "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -I{} echo ${PWD}/{})"
bazel run @com_github_bazelbuild_buildtools//buildifier -- --mode=check ${BAZEL_FILES}
cargo_raze:
name: check format with cargo-raze
Expand Down
7 changes: 7 additions & 0 deletions bazel/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")
load("@proxy_wasm_cpp_host//bazel/cargo/wasmsign:crates.bzl", "wasmsign_fetch_remote_crates")
load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime:crates.bzl", "wasmtime_fetch_remote_crates")
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init")
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
load("@rules_python//python:pip.bzl", "pip_install")
load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains")

def proxy_wasm_cpp_host_dependencies():
# Bazel extensions.
go_rules_dependencies()
go_register_toolchains(version = "1.20.3")

gazelle_dependencies()

rules_foreign_cc_dependencies()

Expand Down
27 changes: 27 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,33 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def proxy_wasm_cpp_host_repositories():
# Bazel extensions.

maybe(
http_archive,
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)
maybe(
http_archive,
name = "bazel_gazelle",
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
],
)

maybe(
http_archive,
name = "com_github_bazelbuild_buildtools",
urls = ["https://github.com/bazelbuild/buildtools/archive/v6.4.0.tar.gz"],
sha256 = "05c3c3602d25aeda1e9dbc91d3b66e624c1f9fdadf273e5480b489e744ca7269",
strip_prefix = "buildtools-6.4.0",
)

maybe(
http_archive,
name = "bazel_skylib",
Expand Down

0 comments on commit 68fc084

Please sign in to comment.