-
Notifications
You must be signed in to change notification settings - Fork 17
204 lines (204 loc) · 8.86 KB
/
master.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{
"jobs": {
"build_and_test": {
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Check out source code",
"uses": "actions/checkout@v1"
},
{
"name": "Installing Bazel",
"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}"
},
{
"name": "Bazel mod tidy",
"run": "bazel mod tidy"
},
{
"name": "Gazelle",
"run": "rm -f $(find . -name '*.pb.go' | sed -e 's/[^/]*$/BUILD.bazel/') && bazel run //:gazelle"
},
{
"name": "Buildifier",
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
},
{
"name": "Gofmt",
"run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -lang 1.19 -w -extra $(pwd)"
},
{
"name": "Clang format",
"run": "find . -name '*.proto' -exec bazel run @llvm_toolchain_llvm//:bin/clang-format -- -i {} +"
},
{
"name": "GitHub workflows",
"run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/*.yaml .github/workflows"
},
{
"name": "Protobuf generation",
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query --output=label '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"
},
{
"name": "Embedded asset generation",
"run": "bazel build $(git grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |//\\1:|' | 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"
},
{
"name": "Test style conformance",
"run": "git add . && git diff --exit-code HEAD --"
},
{
"name": "Golint",
"run": "bazel run @org_golang_x_lint//golint -- -set_exit_status $(pwd)/..."
},
{
"name": "linux_amd64: build and test",
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_amd64 //..."
},
{
"name": "linux_amd64: copy bb_remote_asset",
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
},
{
"name": "linux_amd64: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.linux_amd64",
"path": "bb_remote_asset"
}
},
{
"name": "linux_386: build and test",
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_386 //..."
},
{
"name": "linux_386: copy bb_remote_asset",
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_386 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
},
{
"name": "linux_386: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.linux_386",
"path": "bb_remote_asset"
}
},
{
"name": "linux_arm: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm //..."
},
{
"name": "linux_arm: copy bb_remote_asset",
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
},
{
"name": "linux_arm: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.linux_arm",
"path": "bb_remote_asset"
}
},
{
"name": "linux_arm64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm64 //..."
},
{
"name": "linux_arm64: copy bb_remote_asset",
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
},
{
"name": "linux_arm64: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.linux_arm64",
"path": "bb_remote_asset"
}
},
{
"name": "darwin_amd64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
},
{
"name": "darwin_amd64: copy bb_remote_asset",
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
},
{
"name": "darwin_amd64: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.darwin_amd64",
"path": "bb_remote_asset"
}
},
{
"name": "darwin_arm64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
},
{
"name": "darwin_arm64: copy bb_remote_asset",
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_arm64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
},
{
"name": "darwin_arm64: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.darwin_arm64",
"path": "bb_remote_asset"
}
},
{
"name": "freebsd_amd64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset"
},
{
"name": "freebsd_amd64: copy bb_remote_asset",
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
},
{
"name": "freebsd_amd64: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.freebsd_amd64",
"path": "bb_remote_asset"
}
},
{
"name": "windows_amd64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //..."
},
{
"name": "windows_amd64: copy bb_remote_asset",
"run": "rm -f bb_remote_asset.exe && bazel run --run_under cp --platforms=@rules_go//go/toolchain:windows_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset.exe"
},
{
"name": "windows_amd64: upload bb_remote_asset",
"uses": "actions/upload-artifact@v2-preview",
"with": {
"name": "bb_remote_asset.windows_amd64",
"path": "bb_remote_asset.exe"
}
},
{
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
},
"name": "Install Docker credentials",
"run": "echo \"${GITHUB_TOKEN}\" | docker login ghcr.io -u $ --password-stdin"
},
{
"name": "Push container bb_remote_asset:bb_remote_asset",
"run": "bazel run --stamp //cmd/bb_remote_asset:bb_remote_asset_container_push"
}
]
}
},
"name": "master",
"on": {
"push": {
"branches": [
"master"
]
}
}
}