|
1 | 1 | {
|
2 | 2 | "jobs": {
|
3 | 3 | "build_and_test": {
|
4 |
| - "container": "docker://l.gcr.io/google/bazel:3.3.1", |
5 | 4 | "runs-on": "ubuntu-latest",
|
6 | 5 | "steps": [
|
| 6 | + { |
| 7 | + "name": "Installing Bazel", |
| 8 | + "run": "curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}" |
| 9 | + }, |
7 | 10 | {
|
8 | 11 | "name": "Check out source code",
|
9 | 12 | "uses": "actions/checkout@v1"
|
10 | 13 | },
|
11 | 14 | {
|
12 |
| - "name": "Buildifier", |
13 |
| - "run": "bazel run @com_github_bazelbuild_buildtools//:buildifier" |
| 15 | + "name": "Restore Bazel cache", |
| 16 | + "uses": "actions/cache@v1", |
| 17 | + "with": { |
| 18 | + "key": "bazel", |
| 19 | + "path": "~/.cache/bazel" |
| 20 | + } |
14 | 21 | },
|
15 | 22 | {
|
16 | 23 | "name": "Gazelle",
|
17 | 24 | "run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
|
18 | 25 | },
|
| 26 | + { |
| 27 | + "name": "Buildifier", |
| 28 | + "run": "sed '/^$/d' go_dependencies.bzl > go_dependencies.bzl.new && mv go_dependencies.bzl.new go_dependencies.bzl && bazel run @com_github_bazelbuild_buildtools//:buildifier" |
| 29 | + }, |
19 | 30 | {
|
20 | 31 | "name": "Gofmt",
|
21 |
| - "run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -s -w -extra $(pwd)" |
| 32 | + "run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -lang 1.19 -w -extra $(pwd)" |
22 | 33 | },
|
23 | 34 | {
|
24 | 35 | "name": "Clang format",
|
25 |
| - "run": "find . -name '*.proto' -exec bazel run @llvm_toolchain//:bin/clang-format -- -i {} +" |
| 36 | + "run": "find . -name '*.proto' -exec bazel run @llvm_toolchain_llvm//:bin/clang-format -- -i {} +" |
26 | 37 | },
|
27 | 38 | {
|
28 | 39 | "name": "GitHub workflows",
|
29 |
| - "run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/* .github/workflows" |
| 40 | + "run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/*.yaml .github/workflows" |
| 41 | + }, |
| 42 | + { |
| 43 | + "name": "Protobuf generation", |
| 44 | + "run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n" |
30 | 45 | },
|
31 | 46 | {
|
32 | 47 | "name": "Test style conformance",
|
|
36 | 51 | "name": "Golint",
|
37 | 52 | "run": "bazel run @org_golang_x_lint//golint -- -set_exit_status $(pwd)/..."
|
38 | 53 | },
|
39 |
| - { |
40 |
| - "name": "Check for ineffective assignments", |
41 |
| - "run": "bazel run @com_github_gordonklaus_ineffassign//:ineffassign $(pwd)" |
42 |
| - }, |
43 | 54 | {
|
44 | 55 | "name": "linux_amd64: build and test",
|
45 |
| - "run": "bazel test --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..." |
| 56 | + "run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..." |
46 | 57 | },
|
47 | 58 | {
|
48 | 59 | "name": "linux_amd64: copy bb_remote_asset",
|
49 |
| - "run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
| 60 | + "run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
50 | 61 | },
|
51 | 62 | {
|
52 | 63 | "name": "linux_amd64: upload bb_remote_asset",
|
|
56 | 67 | "path": "bb_remote_asset"
|
57 | 68 | }
|
58 | 69 | },
|
| 70 | + { |
| 71 | + "name": "linux_386: build and test", |
| 72 | + "run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //..." |
| 73 | + }, |
| 74 | + { |
| 75 | + "name": "linux_386: copy bb_remote_asset", |
| 76 | + "run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
| 77 | + }, |
| 78 | + { |
| 79 | + "name": "linux_386: upload bb_remote_asset", |
| 80 | + "uses": "actions/upload-artifact@v2-preview", |
| 81 | + "with": { |
| 82 | + "name": "bb_remote_asset.linux_386", |
| 83 | + "path": "bb_remote_asset" |
| 84 | + } |
| 85 | + }, |
| 86 | + { |
| 87 | + "name": "linux_arm: build and test", |
| 88 | + "run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //..." |
| 89 | + }, |
| 90 | + { |
| 91 | + "name": "linux_arm: copy bb_remote_asset", |
| 92 | + "run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
| 93 | + }, |
| 94 | + { |
| 95 | + "name": "linux_arm: upload bb_remote_asset", |
| 96 | + "uses": "actions/upload-artifact@v2-preview", |
| 97 | + "with": { |
| 98 | + "name": "bb_remote_asset.linux_arm", |
| 99 | + "path": "bb_remote_asset" |
| 100 | + } |
| 101 | + }, |
| 102 | + { |
| 103 | + "name": "linux_arm64: build and test", |
| 104 | + "run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //..." |
| 105 | + }, |
| 106 | + { |
| 107 | + "name": "linux_arm64: copy bb_remote_asset", |
| 108 | + "run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
| 109 | + }, |
| 110 | + { |
| 111 | + "name": "linux_arm64: upload bb_remote_asset", |
| 112 | + "uses": "actions/upload-artifact@v2-preview", |
| 113 | + "with": { |
| 114 | + "name": "bb_remote_asset.linux_arm64", |
| 115 | + "path": "bb_remote_asset" |
| 116 | + } |
| 117 | + }, |
59 | 118 | {
|
60 | 119 | "name": "darwin_amd64: build and test",
|
61 | 120 | "run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //..."
|
62 | 121 | },
|
63 | 122 | {
|
64 | 123 | "name": "darwin_amd64: copy bb_remote_asset",
|
65 |
| - "run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
| 124 | + "run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
66 | 125 | },
|
67 | 126 | {
|
68 | 127 | "name": "darwin_amd64: upload bb_remote_asset",
|
|
72 | 131 | "path": "bb_remote_asset"
|
73 | 132 | }
|
74 | 133 | },
|
| 134 | + { |
| 135 | + "name": "darwin_arm64: build and test", |
| 136 | + "run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //..." |
| 137 | + }, |
| 138 | + { |
| 139 | + "name": "darwin_arm64: copy bb_remote_asset", |
| 140 | + "run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
| 141 | + }, |
| 142 | + { |
| 143 | + "name": "darwin_arm64: upload bb_remote_asset", |
| 144 | + "uses": "actions/upload-artifact@v2-preview", |
| 145 | + "with": { |
| 146 | + "name": "bb_remote_asset.darwin_arm64", |
| 147 | + "path": "bb_remote_asset" |
| 148 | + } |
| 149 | + }, |
75 | 150 | {
|
76 | 151 | "name": "freebsd_amd64: build and test",
|
77 | 152 | "run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset"
|
78 | 153 | },
|
79 | 154 | {
|
80 | 155 | "name": "freebsd_amd64: copy bb_remote_asset",
|
81 |
| - "run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
| 156 | + "run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset" |
82 | 157 | },
|
83 | 158 | {
|
84 | 159 | "name": "freebsd_amd64: upload bb_remote_asset",
|
|
94 | 169 | },
|
95 | 170 | {
|
96 | 171 | "name": "windows_amd64: copy bb_remote_asset",
|
97 |
| - "run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset.exe" |
| 172 | + "run": "rm -f bb_remote_asset.exe && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset.exe" |
98 | 173 | },
|
99 | 174 | {
|
100 | 175 | "name": "windows_amd64: upload bb_remote_asset",
|
|
106 | 181 | },
|
107 | 182 | {
|
108 | 183 | "env": {
|
109 |
| - "DOCKER_CONFIG_JSON": "${{ secrets.DOCKER_CONFIG_JSON }}" |
| 184 | + "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}" |
110 | 185 | },
|
111 | 186 | "name": "Install Docker credentials",
|
112 |
| - "run": "mkdir ~/.docker && echo \"${DOCKER_CONFIG_JSON}\" > ~/.docker/config.json" |
| 187 | + "run": "echo \"${GITHUB_TOKEN}\" | docker login ghcr.io -u $ --password-stdin" |
113 | 188 | },
|
114 | 189 | {
|
115 | 190 | "name": "Push container bb_remote_asset:bb_remote_asset",
|
116 |
| - "run": "bazel run //cmd/bb_remote_asset:bb_remote_asset_container_push" |
| 191 | + "run": "bazel run --stamp //cmd/bb_remote_asset:bb_remote_asset_container_push" |
117 | 192 | }
|
118 | 193 | ]
|
119 | 194 | }
|
|
0 commit comments