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

bazel 6.4.0, rules_go v0.45, bazel-gazelle 0.35, more... #355

Merged
merged 49 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3dd81f2
bazel run gazelle
pcj Dec 30, 2023
36f68b3
Convert to yaml config
pcj Dec 30, 2023
3926580
Vendor timestamp.proto (for ts_proto)
pcj Dec 30, 2023
19b6098
Switch to proto_gazelle rule
pcj Dec 30, 2023
cd8dbb0
Fix missing NonEmptyAttrs
pcj Dec 30, 2023
f59597b
Reset baseline generated rules using proto_gazelle
pcj Dec 30, 2023
202e9a0
Run proto_gazelle now with imports
pcj Jan 2, 2024
7436391
bb //example/routeguide:all
pcj Jan 2, 2024
5e707b4
Upgrade rules_go, gazelle, go_deps
pcj Jan 2, 2024
5809c14
Upgrade go deps
pcj Jan 2, 2024
a960503
make deps
pcj Jan 2, 2024
7bdc8ab
Upgrade gazelle to v0.35.0
pcj Jan 2, 2024
fcda7d9
load proto_repository_tools
pcj Jan 2, 2024
f56338c
Migrate resolver to accomodate https://github.com/bazelbuild/bazel-ga…
pcj Jan 2, 2024
1228071
checkpoint trying to get protobuf-javascript compiling
pcj Jan 2, 2024
25e7e77
checkpoint migrate to protobuf-javascript
pcj Jan 2, 2024
dda84de
checkpoint build all routeguide
pcj Jan 2, 2024
07ed49c
recover grpc_closure_js_library
pcj Jan 2, 2024
dc70a6f
enable scala
pcj Jan 2, 2024
60177b4
enable java
pcj Jan 2, 2024
a05a802
resolve cc wkt
pcj Jan 2, 2024
1cb98f1
resolve java wkts
pcj Jan 2, 2024
d87d106
enable go
pcj Jan 2, 2024
7c4e1ff
enable python
pcj Jan 2, 2024
4328e55
enable node_js
pcj Jan 3, 2024
d70f6c7
enable ts_proto
pcj Jan 3, 2024
fa9c170
make tidy
pcj Jan 3, 2024
2999722
fix tests
pcj Jan 3, 2024
54b2dd9
prep github actions
pcj Jan 3, 2024
2f3798b
bazel run gazelle
pcj Jan 3, 2024
c18a182
rerun gazelle
pcj Jan 3, 2024
bc10591
Use java 17, upgrade rules_scala, custom toolchain
pcj Jan 3, 2024
9abbea9
sync scala version
pcj Jan 3, 2024
aef479d
Upgrade rules_python and add to WORKSPACE boilerplate files
pcj Jan 3, 2024
facb330
Add :protobuf_python to example deps
pcj Jan 3, 2024
5868e39
ensure strings sorted for import labels
pcj Jan 3, 2024
ca443a7
Disable failing CI test
pcj Jan 3, 2024
a96563d
Skip other test
pcj Jan 3, 2024
516c136
Upgrade rules_go to v0.45.1
pcj Jan 26, 2024
9caccf8
exclude grpc_test.go from default go_test rule
pcj Feb 13, 2024
5375b3b
remove test pass check
pcj Feb 13, 2024
1928c25
remove obsolete patch
pcj Feb 13, 2024
d61d43e
Merge branch 'master' into update-deps-and-use-yaml-config-file
pcj Feb 13, 2024
72d5e41
Add "make golden_test" target
pcj Feb 13, 2024
c39ff7f
ensure reassign memory value
pcj Feb 13, 2024
5fd91fe
Update build status badge
pcj Feb 13, 2024
c7bf50f
preserve last-wins semantics of prior stackb/rules_proto behavior
pcj Feb 13, 2024
7b0552d
Merge branch 'master' into update-deps-and-use-yaml-config-file
pcj Feb 13, 2024
9103472
Update release.yaml
pcj Feb 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 13 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
common --enable_platform_specific_config

common --jvmopt=-Djava.security.manager=allow
build --java_language_version=17
build --java_runtime_version=remotejdk_17
build --tool_java_language_version=17
build --tool_java_runtime_version=remotejdk_17

common --enable_platform_specific_config
build:windows --cxxopt='/std:c++14'
build:windows --host_cxxopt='/std:c++14'
build:linux --cxxopt='-std=c++14'
build:linux --host_cxxopt='-std=c++14'
build:macos --cxxopt='-std=c++14'
build:macos --host_cxxopt='-std=c++14'
build:freebsd --cxxopt='-std=c++14'
build:freebsd --host_cxxopt='-std=c++14'
build:linux --cxxopt='-std=c++14'
build:linux --host_cxxopt='-std=c++14'
build:macos --cxxopt='-std=c++14'
build:macos --host_cxxopt='-std=c++14'
build:freebsd --cxxopt='-std=c++14'
build:freebsd --host_cxxopt='-std=c++14'

build:bazelci --deleted_packages=docs

Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.0
6.4.0
14 changes: 14 additions & 0 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file contains Bazel settings to apply on CI only.
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml
# Debug where options came from
build --announce_rc
# Don't rely on test logs being easily accessible from the test runner,
# though it makes the log noisier.
test --test_output=errors
# This directory is configured in GitHub actions to be persisted between runs.
build --disk_cache=$HOME/.cache/bazel
build --repository_cache=$HOME/.cache/bazel-repo
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
test --test_env=XDG_CACHE_HOME
# Keep until @io_bazel_rules_scala is upgraded
build --incompatible_java_common_parameters=false
54 changes: 54 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3

- uses: bazelbuild/setup-bazelisk@v2

- name: Mount bazel action cache
uses: actions/cache@v3
if: always()
with:
path: "~/.cache/bazel"
key: bazel

- name: Mount bazel repo cache
uses: actions/cache@v3
if: always()
with:
path: "~/.cache/bazel-repo"
key: bazel-repo

- name: bazel test
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: >-
bazel
--bazelrc=.github/workflows/ci.bazelrc
--bazelrc=.bazelrc
test
--deleted_packages=//plugin/grpc-ecosystem/grpc-gateway
//example/...
//pkg/...
//plugin/...
//language/...
//rules/...
//toolchain/...
44 changes: 44 additions & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Format

# 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:
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3

- uses: bazelbuild/setup-bazelisk@v2

- name: Mount bazel action cache
uses: actions/cache@v2
with:
path: "~/.cache/bazel"
key: bazel

- name: Mount bazel repo cache
uses: actions/cache@v2
with:
path: "~/.cache/bazel-repo"
key: bazel-repo

- name: Run format
env:
# Bazelisk will download bazel to here, ensure it is cached between runs.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: ./tools/format.sh

- name: Check no changes
run: bash -c "if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then echo >&2 'Please run \`./tools/format.sh\` - Found differences after formatting:' && git diff && exit 1; fi"
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Cut a release whenever a new tag is pushed to the repo.
name: Release

on:
push:
tags:
- "v*.*.*"

# Allows owner to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare workspace snippet
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt

- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: false
# Use GH feature to populate the changelog automatically
generate_release_notes: true
body_path: release_notes.txt
22 changes: 22 additions & 0 deletions .github/workflows/workspace_snippet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -eufo pipefail

# Set by GH actions, see
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
TAG=${GITHUB_REF_NAME}
PREFIX="rules_proto-${TAG:1}"
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')

cat << EOF
WORKSPACE snippet:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_stack_rules_proto",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/stackb/rules_proto/archive/refs/tags/${TAG}.tar.gz",
)
\`\`\`
EOF
10 changes: 9 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@npm_ts_proto//:defs.bzl", "npm_link_all_packages")
load("@//rules:proto_gazelle.bzl", "proto_gazelle")

exports_files(["rules_proto_config.yaml"])

# ----------------------------------------------------
# Buildifier
Expand Down Expand Up @@ -28,9 +31,14 @@ gazelle_binary(
visibility = ["//visibility:public"],
)

gazelle(
proto_gazelle(
name = "gazelle",
cfgs = [":rules_proto_config.yaml"],
gazelle = ":gazelle-protobuf",
imports = [
"@googleapis//:imports.csv",
"@protoapis//:imports.csv",
],
)

gazelle(
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BAZEL := bzl
BAZEL := bazel

.PHONY: tidy
tidy: deps
Expand All @@ -9,6 +9,10 @@ tidy: deps
$(BAZEL) run //:buildifier
$(BAZEL) run //:gazelle

.PHONY: gazelle
gazelle:
$(BAZEL) run //:gazelle

.PHONY: deps
deps:
$(BAZEL) build //deps:*
Expand All @@ -21,9 +25,13 @@ site:
$(BAZEL) build //example/golden:*
cp -f ./bazel-bin/example/golden/*.md docs/

.PHONY: golden_test
golden_test:
$(BAZEL) test //example/golden:golden_test

.PHONY: test
test:
$(BAZEL) test //example/... //pkg/... //plugin/... //language/... //rules/... //toolchain/... \
$(BAZEL) test --keep_going //example/... //pkg/... //plugin/... //language/... //rules/... //toolchain/... \
--deleted_packages=//plugin/grpc-ecosystem/grpc-gateway

.PHONY: get
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `rules_proto (v3)`

[![Build status](https://badge.buildkite.com/5980cc1d55f96e721bd9a7bd5dc1e40a096a7c30bc13117910.svg?branch=master)](https://buildkite.com/bazel/stackb-rules-proto)
![build-status](https://github.com/stackb/rules_proto/actions/workflows/ci.yaml/badge.svg)
[![Go Reference](https://pkg.go.dev/badge/github.com/stackb/rules_proto.svg)](https://pkg.go.dev/github.com/stackb/rules_proto)

Bazel starlark rules for building protocol buffers +/- gRPC :sparkles:.
Expand Down Expand Up @@ -597,7 +597,7 @@ proto_repository(
build_file_generation = "clean",
build_file_proto_mode = "file",
reresolve_known_proto_imports = True,
proto_language_config_file = "//example:config.yaml",
proto_language_config_file = "@//:rules_proto_config.yaml",
strip_prefix = "googleapis-02710fa0ea5312d79d7fb986c9c9823fb41049a9",
type = "zip",
urls = ["https://codeload.github.com/googleapis/googleapis/zip/02710fa0ea5312d79d7fb986c9c9823fb41049a9"],
Expand Down