|
| 1 | +{ |
| 2 | + "jobs": { |
| 3 | + "build_and_test": { |
| 4 | + "runs-on": "ubuntu-latest", |
| 5 | + "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": "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" |
| 41 | + }, |
| 42 | + { |
| 43 | + "name": "Embedded asset generation", |
| 44 | + "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" |
| 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_portal", |
| 60 | + "run": "rm -f bb_portal && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_amd64 //cmd/bb_portal $(pwd)/bb_portal" |
| 61 | + }, |
| 62 | + { |
| 63 | + "name": "linux_amd64: upload bb_portal", |
| 64 | + "uses": "actions/upload-artifact@v4", |
| 65 | + "with": { |
| 66 | + "name": "bb_portal.linux_amd64", |
| 67 | + "path": "bb_portal" |
| 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_portal", |
| 76 | + "run": "rm -f bb_portal && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_386 //cmd/bb_portal $(pwd)/bb_portal" |
| 77 | + }, |
| 78 | + { |
| 79 | + "name": "linux_386: upload bb_portal", |
| 80 | + "uses": "actions/upload-artifact@v4", |
| 81 | + "with": { |
| 82 | + "name": "bb_portal.linux_386", |
| 83 | + "path": "bb_portal" |
| 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_portal", |
| 92 | + "run": "rm -f bb_portal && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm //cmd/bb_portal $(pwd)/bb_portal" |
| 93 | + }, |
| 94 | + { |
| 95 | + "name": "linux_arm: upload bb_portal", |
| 96 | + "uses": "actions/upload-artifact@v4", |
| 97 | + "with": { |
| 98 | + "name": "bb_portal.linux_arm", |
| 99 | + "path": "bb_portal" |
| 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_portal", |
| 108 | + "run": "rm -f bb_portal && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm64 //cmd/bb_portal $(pwd)/bb_portal" |
| 109 | + }, |
| 110 | + { |
| 111 | + "name": "linux_arm64: upload bb_portal", |
| 112 | + "uses": "actions/upload-artifact@v4", |
| 113 | + "with": { |
| 114 | + "name": "bb_portal.linux_arm64", |
| 115 | + "path": "bb_portal" |
| 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_portal", |
| 124 | + "run": "rm -f bb_portal && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_amd64 //cmd/bb_portal $(pwd)/bb_portal" |
| 125 | + }, |
| 126 | + { |
| 127 | + "name": "darwin_amd64: upload bb_portal", |
| 128 | + "uses": "actions/upload-artifact@v4", |
| 129 | + "with": { |
| 130 | + "name": "bb_portal.darwin_amd64", |
| 131 | + "path": "bb_portal" |
| 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_portal", |
| 140 | + "run": "rm -f bb_portal && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_arm64 //cmd/bb_portal $(pwd)/bb_portal" |
| 141 | + }, |
| 142 | + { |
| 143 | + "name": "darwin_arm64: upload bb_portal", |
| 144 | + "uses": "actions/upload-artifact@v4", |
| 145 | + "with": { |
| 146 | + "name": "bb_portal.darwin_arm64", |
| 147 | + "path": "bb_portal" |
| 148 | + } |
| 149 | + }, |
| 150 | + { |
| 151 | + "name": "freebsd_amd64: build and test", |
| 152 | + "run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_portal" |
| 153 | + }, |
| 154 | + { |
| 155 | + "name": "freebsd_amd64: copy bb_portal", |
| 156 | + "run": "rm -f bb_portal && bazel run --run_under cp --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_portal $(pwd)/bb_portal" |
| 157 | + }, |
| 158 | + { |
| 159 | + "name": "freebsd_amd64: upload bb_portal", |
| 160 | + "uses": "actions/upload-artifact@v4", |
| 161 | + "with": { |
| 162 | + "name": "bb_portal.freebsd_amd64", |
| 163 | + "path": "bb_portal" |
| 164 | + } |
| 165 | + }, |
| 166 | + { |
| 167 | + "name": "windows_amd64: build and test", |
| 168 | + "run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //..." |
| 169 | + }, |
| 170 | + { |
| 171 | + "name": "windows_amd64: copy bb_portal", |
| 172 | + "run": "rm -f bb_portal.exe && bazel run --run_under cp --platforms=@rules_go//go/toolchain:windows_amd64 //cmd/bb_portal $(pwd)/bb_portal.exe" |
| 173 | + }, |
| 174 | + { |
| 175 | + "name": "windows_amd64: upload bb_portal", |
| 176 | + "uses": "actions/upload-artifact@v4", |
| 177 | + "with": { |
| 178 | + "name": "bb_portal.windows_amd64", |
| 179 | + "path": "bb_portal.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_portal:bb_portal", |
| 191 | + "run": "bazel run --stamp //cmd/bb_portal:bb_portal_container_push" |
| 192 | + } |
| 193 | + ] |
| 194 | + } |
| 195 | + }, |
| 196 | + "name": "master", |
| 197 | + "on": { |
| 198 | + "push": { |
| 199 | + "branches": [ |
| 200 | + "master" |
| 201 | + ] |
| 202 | + } |
| 203 | + } |
| 204 | +} |
0 commit comments