Skip to content

Commit 4b6cd55

Browse files
committed
Start using gazelle:proto_import_prefix
1 parent 78694d7 commit 4b6cd55

File tree

13 files changed

+352
-230
lines changed

13 files changed

+352
-230
lines changed

.github/workflows/master.yaml

Lines changed: 101 additions & 19 deletions
Large diffs are not rendered by default.

.github/workflows/pull-requests.yaml

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,136 @@
11
{
22
"jobs": {
33
"build_and_test": {
4-
"runs-on": "ubuntu-latest",
4+
"name": "build_and_test ${{ matrix.host.os }}",
5+
"runs-on": "${{ matrix.host.os }}",
56
"steps": [
67
{
78
"name": "Check out source code",
89
"uses": "actions/checkout@v1"
910
},
1011
{
1112
"name": "Installing Bazel",
12-
"run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
13+
"run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-${{matrix.host.bazel_os}}-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}",
14+
"shell": "bash"
1315
},
1416
{
17+
"if": "matrix.host.platform_name == 'windows_amd64'",
18+
"name": "Override .bazelrc",
19+
"run": "echo \"startup --output_base=D:/bazel_output\" >> .bazelrc"
20+
},
21+
{
22+
"if": "matrix.host.lint",
1523
"name": "Bazel mod tidy",
1624
"run": "bazel mod tidy"
1725
},
1826
{
27+
"if": "matrix.host.lint",
1928
"name": "Gazelle",
2029
"run": "rm -f $(find . -name '*.pb.go' | sed -e 's/[^/]*$/BUILD.bazel/') && bazel run //:gazelle"
2130
},
2231
{
32+
"if": "matrix.host.lint",
2333
"name": "Buildifier",
2434
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
2535
},
2636
{
37+
"if": "matrix.host.lint",
2738
"name": "Gofmt",
2839
"run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -w -extra $(pwd)"
2940
},
3041
{
42+
"if": "matrix.host.lint",
3143
"name": "Clang format",
3244
"run": "find . -name '*.proto' -exec bazel run @llvm_toolchain_llvm//:bin/clang-format -- -i {} +"
3345
},
3446
{
47+
"if": "matrix.host.lint",
3548
"name": "GitHub workflows",
3649
"run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/*.yaml .github/workflows"
3750
},
3851
{
52+
"if": "matrix.host.lint",
3953
"name": "Protobuf generation",
4054
"run": "if [ -d pkg/proto ]; then\n find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\n bazel build $(bazel query --output=label 'kind(\"go_proto_library\", //...)')\n find bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\n done\nfi\n"
4155
},
4256
{
57+
"if": "matrix.host.lint",
4358
"name": "Embedded asset generation",
4459
"run": "bazel build $(git grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |//\\1:|; s|\"||g; s| .*||' | sort -u)\ngit grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |\\1/|' | while read o; do\n if [ -e \"bazel-bin/$o\" ]; then\n rm -rf \"$o\"\n cp -r \"bazel-bin/$o\" \"$o\"\n find \"$o\" -type f -exec chmod -x {} +\n fi\ndone\n"
4560
},
4661
{
62+
"if": "matrix.host.lint",
4763
"name": "Test style conformance",
4864
"run": "git add . && git diff --exit-code HEAD --"
4965
},
5066
{
67+
"if": "matrix.host.lint",
5168
"name": "Golint",
5269
"run": "bazel run @org_golang_x_lint//golint -- -set_exit_status $(pwd)/..."
5370
},
5471
{
55-
"name": "linux_amd64: build and test",
56-
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_amd64 //..."
72+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_amd64'",
73+
"name": "linux_amd64: build${{ matrix.host.platform_name == 'linux_amd64' && ' and test' || '' }}",
74+
"run": "bazel ${{ matrix.host.platform_name == 'linux_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_amd64 //..."
5775
},
5876
{
59-
"name": "linux_386: build and test",
60-
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_386 //..."
77+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_386'",
78+
"name": "linux_386: build${{ matrix.host.platform_name == 'linux_amd64' && ' and test' || '' }}",
79+
"run": "bazel ${{ matrix.host.platform_name == 'linux_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_386 //..."
6180
},
6281
{
63-
"name": "linux_arm: build and test",
64-
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm //..."
82+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_arm'",
83+
"name": "linux_arm: build${{ matrix.host.platform_name == 'linux_arm' && ' and test' || '' }}",
84+
"run": "bazel ${{ matrix.host.platform_name == 'linux_arm' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_arm //..."
6585
},
6686
{
67-
"name": "linux_arm64: build and test",
68-
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm64 //..."
87+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_arm64'",
88+
"name": "linux_arm64: build${{ matrix.host.platform_name == 'linux_arm64' && ' and test' || '' }}",
89+
"run": "bazel ${{ matrix.host.platform_name == 'linux_arm64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_arm64 //..."
6990
},
7091
{
71-
"name": "darwin_amd64: build and test",
72-
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
92+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'darwin_amd64'",
93+
"name": "darwin_amd64: build${{ matrix.host.platform_name == 'darwin_amd64' && ' and test' || '' }}",
94+
"run": "bazel ${{ matrix.host.platform_name == 'darwin_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
7395
},
7496
{
75-
"name": "darwin_arm64: build and test",
76-
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
97+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'darwin_arm64'",
98+
"name": "darwin_arm64: build${{ matrix.host.platform_name == 'darwin_arm64' && ' and test' || '' }}",
99+
"run": "bazel ${{ matrix.host.platform_name == 'darwin_arm64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
77100
},
78101
{
79-
"name": "freebsd_amd64: build and test",
80-
"run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
102+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'freebsd_amd64'",
103+
"name": "freebsd_amd64: build${{ matrix.host.platform_name == 'freebsd_amd64' && ' and test' || '' }}",
104+
"run": "bazel ${{ matrix.host.platform_name == 'freebsd_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:freebsd_amd64 //..."
81105
},
82106
{
83-
"name": "windows_amd64: build and test",
84-
"run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
107+
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'windows_amd64'",
108+
"name": "windows_amd64: build${{ matrix.host.platform_name == 'windows_amd64' && ' and test' || '' }}",
109+
"run": "bazel ${{ matrix.host.platform_name == 'windows_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:windows_amd64 //..."
85110
}
86-
]
111+
],
112+
"strategy": {
113+
"matrix": {
114+
"host": [
115+
{
116+
"bazel_os": "linux",
117+
"cross_compile": true,
118+
"lint": true,
119+
"os": "ubuntu-latest",
120+
"platform_name": "linux_amd64",
121+
"upload": true
122+
},
123+
{
124+
"bazel_os": "windows",
125+
"cross_compile": false,
126+
"lint": false,
127+
"os": "windows-latest",
128+
"platform_name": "windows_amd64",
129+
"upload": false
130+
}
131+
]
132+
}
133+
}
87134
}
88135
},
89136
"name": "pull-requests",

BUILD.bazel

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ load("@gazelle//:def.bzl", "gazelle")
33
# gazelle:go_naming_convention_external import
44
# gazelle:go_naming_convention_external import
55
# gazelle:prefix github.com/buildbarn/bb-autoscaler
6+
# gazelle:proto_import_prefix github.com/buildbarn/bb-autoscaler
67
# gazelle:resolve go github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2 @bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_go_proto
78
# gazelle:resolve go github.com/bazelbuild/remote-apis/build/bazel/semver @bazel_remote_apis//build/bazel/semver:semver_go_proto
89
# gazelle:resolve proto build/bazel/remote/execution/v2/remote_execution.proto @bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_proto
910
# gazelle:resolve proto go build/bazel/remote/execution/v2/remote_execution.proto @bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_go_proto
10-
# gazelle:resolve proto go pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws
11-
# gazelle:resolve proto go pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global
12-
# gazelle:resolve proto go pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc
13-
# gazelle:resolve proto go pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http
14-
# gazelle:resolve proto pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws:aws_proto
15-
# gazelle:resolve proto pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto
16-
# gazelle:resolve proto pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:grpc_proto
17-
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
11+
# gazelle:resolve_regexp proto github.com/buildbarn/bb-storage/(.*)/(.*)\.proto @com_github_buildbarn_bb_storage//$1:${2}_proto
12+
# gazelle:resolve_regexp proto go github.com/buildbarn/bb-storage/(.*)/(.*)\.proto @com_github_buildbarn_bb_storage//$1:$2
1813
gazelle(
1914
name = "gazelle",
2015
)

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ git_override(
2020

2121
git_override(
2222
module_name = "com_github_buildbarn_bb_remote_execution",
23-
commit = "410ea5cf12ac778e3774f2c84af938bf98f47c57",
23+
commit = "78a187fdbd351f57e3db9e31e3f59161eca26b17",
2424
remote = "https://github.com/buildbarn/bb-remote-execution.git",
2525
)
2626

2727
git_override(
2828
module_name = "com_github_buildbarn_bb_storage",
29-
commit = "a3f0c77a996f0801a875a604c22608d94f06c910",
29+
commit = "1170df56abab658861ba90c0e57b58ed14b721a2",
3030
remote = "https://github.com/buildbarn/bb-storage.git",
3131
)
3232

MODULE.bazel.lock

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)