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