Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci/buildifier: Install and run with bazel (+update bazel -> 5.4.0) #387

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 11 additions & 1 deletion bazel/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,29 @@
# 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():
GO_VERSION = "1.20.3"

# Set go_version=host to use host go
def proxy_wasm_cpp_host_dependencies(go_version = GO_VERSION):
# Bazel extensions.

go_rules_dependencies()
go_register_toolchains(version = go_version)
gazelle_dependencies()

rules_foreign_cc_dependencies()

rules_fuzzing_dependencies()
Expand Down
28 changes: 28 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@ 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 = "80a98277ad1311dacd837f9b16db62887702e9f1d1c4c9f796d0121a46c8e184",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.46.1/rules_go-v0.46.0.zip",
],
)

maybe(
http_archive,
name = "bazel_gazelle",
sha256 = "32938bda16e6700063035479063d9d24c60eda8d79fd4739563f50d331cb3209",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.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
Loading