Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ common:remote-exec-windows --features=-parse_showincludes --host_features=-parse
# When running bare executors on your own host machine.
build:remote-local --config=remote-exec

common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc
common --incompatible_enable_proto_toolchain_resolution

# Required to make protobuf compile on Windows
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.1
8.6.0
168 changes: 105 additions & 63 deletions .github/workflows/master.yaml → .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,95 +33,50 @@
"name": "Override .bazelrc",
"run": "echo \"startup --output_base=D:/bazel_output\" >> .bazelrc"
},
{
"if": "matrix.host.lint",
"name": "Bazel mod tidy",
"run": "bazel mod tidy"
},
{
"if": "matrix.host.lint",
"name": "Gazelle",
"run": "rm -f $(find . -name '*.pb.go' | sed -e 's/[^/]*$/BUILD.bazel/') && bazel run //:gazelle"
},
{
"if": "matrix.host.lint",
"name": "Buildifier",
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
},
{
"if": "matrix.host.lint",
"name": "Gofmt",
"run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -w -extra $(pwd)"
},
{
"if": "matrix.host.lint",
"name": "Clang format",
"run": "find . -name '*.proto' -exec bazel run @llvm_toolchain_llvm//:bin/clang-format -- -i {} +"
},
{
"if": "matrix.host.lint",
"name": "GitHub workflows",
"run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/*.yaml .github/workflows"
},
{
"if": "matrix.host.lint",
"name": "Protobuf generation",
"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"
},
{
"if": "matrix.host.lint",
"name": "Embedded asset generation",
"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"
},
{
"if": "matrix.host.lint",
"name": "Test style conformance",
"run": "git add . && git diff --exit-code HEAD --"
},
{
"if": "matrix.host.lint",
"name": "Golint",
"run": "bazel run @org_golang_x_lint//golint -- -set_exit_status $(pwd)/..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_amd64'",
"name": "linux_amd64: build${{ matrix.host.platform_name == 'linux_amd64' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'linux_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_amd64 //..."
"run": "bazel ${{ matrix.host.platform_name == 'linux_amd64' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:linux_amd64' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_amd64_v3'",
"name": "linux_amd64_v3: build${{ matrix.host.platform_name == 'linux_amd64_v3' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'linux_amd64_v3' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:linux_amd64_v3' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_386'",
"name": "linux_386: build${{ matrix.host.platform_name == 'linux_amd64' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'linux_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_386 //..."
"run": "bazel ${{ matrix.host.platform_name == 'linux_amd64' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:linux_386' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_arm'",
"name": "linux_arm: build${{ matrix.host.platform_name == 'linux_arm' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'linux_arm' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_arm //..."
"run": "bazel ${{ matrix.host.platform_name == 'linux_arm' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:linux_arm' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'linux_arm64'",
"name": "linux_arm64: build${{ matrix.host.platform_name == 'linux_arm64' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'linux_arm64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:linux_arm64 //..."
"run": "bazel ${{ matrix.host.platform_name == 'linux_arm64' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:linux_arm64' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'darwin_amd64'",
"name": "darwin_amd64: build${{ matrix.host.platform_name == 'darwin_amd64' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'darwin_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
"run": "bazel ${{ matrix.host.platform_name == 'darwin_amd64' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:darwin_amd64' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'darwin_arm64'",
"name": "darwin_arm64: build${{ matrix.host.platform_name == 'darwin_arm64' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'darwin_arm64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
"run": "bazel ${{ matrix.host.platform_name == 'darwin_arm64' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:darwin_arm64' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'freebsd_amd64'",
"name": "freebsd_amd64: build${{ matrix.host.platform_name == 'freebsd_amd64' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'freebsd_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:freebsd_amd64 //..."
"run": "bazel ${{ matrix.host.platform_name == 'freebsd_amd64' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:freebsd_amd64' }} //..."
},
{
"if": "matrix.host.cross_compile || matrix.host.platform_name == 'windows_amd64'",
"name": "windows_amd64: build${{ matrix.host.platform_name == 'windows_amd64' && ' and test' || '' }}",
"run": "bazel ${{ matrix.host.platform_name == 'windows_amd64' && 'test --test_output=errors' || 'build' }} --platforms=@rules_go//go/toolchain:windows_amd64 //..."
"run": "bazel ${{ matrix.host.platform_name == 'windows_amd64' && 'test --test_output=errors' || 'build --platforms=@com_github_buildbarn_bb_storage//tools/platforms:windows_amd64' }} //..."
},
{
"if": "matrix.host.lint",
Expand Down Expand Up @@ -171,6 +126,11 @@
"if": "matrix.host.upload",
"name": "Install Docker credentials",
"run": "echo \"${GITHUB_TOKEN}\" | docker login ghcr.io -u $ --password-stdin"
},
{
"if": "matrix.host.upload",
"name": "Clean Bazel cache from previous steps",
"run": "bazel clean"
}
],
"strategy": {
Expand All @@ -179,30 +139,112 @@
{
"bazel_os": "linux",
"cross_compile": true,
"lint": true,
"os": "ubuntu-latest",
"platform_name": "linux_amd64",
"upload": true
},
{
"bazel_os": "windows",
"cross_compile": false,
"lint": false,
"os": "windows-latest",
"platform_name": "windows_amd64",
"upload": false
}
]
}
}
},
"lint": {
"name": "lint",
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Check out source code",
"uses": "actions/checkout@v1"
},
{
"if": "matrix.host.platform_name == 'linux_amd64'",
"name": "Installing grpcurl",
"run": "mkdir -p ~/.cache/grpcurl &&\ncurl -L https://github.com/fullstorydev/grpcurl/releases/download/v1.8.9/grpcurl_1.8.9_linux_x86_64.tar.gz | tar -xz -C ~/.cache/grpcurl &&\necho \"~/.cache/grpcurl\" >> ${GITHUB_PATH}\n"
},
{
"if": "matrix.host.platform_name == 'linux_amd64'",
"name": "Install k3d",
"run": "curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash"
},
{
"if": "matrix.host.platform_name == 'windows_amd64'",
"name": "Install WinFSP",
"run": "choco install winfsp"
},
{
"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}",
"shell": "bash"
},
{
"name": "Reformat",
"run": "bazel run @com_github_buildbarn_bb_storage//tools:reformat"
},
{
"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)/..."
}
]
},
"publish": {
"name": "publish",
"needs": [
"build_and_test"
],
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Checkout the repository",
"uses": "actions/checkout@v4 "
},
{
"name": "Download release artifacts",
"uses": "actions/download-artifact@v4",
"with": {
"merge-multiple": true,
"path": "assets"
}
},
{
"name": "Calculate shasum",
"run": "shasum -a 256 assets/* > sha256"
},
{
"name": "Set release Git user",
"run": "git config --global user.email \"41898282+github-actions[bot]@users.noreply.github.com\"\ngit config --global user.name \"github-actions[bot]\"\n"
},
{
"id": "create_tag",
"name": "Generate tag",
"run": "BUILD_SCM_REVISION=$(git rev-parse --short HEAD)\nBUILD_SCM_TIMESTAMP=$(TZ=UTC date --date \"@$(git show -s --format=%ct HEAD)\" +%Y%m%dT%H%M%SZ)\nRELEASE_TAG=\"${BUILD_SCM_TIMESTAMP}-${BUILD_SCM_REVISION}\"\ngit tag $RELEASE_TAG\ngit push --follow-tags\necho \"release_tag=$RELEASE_TAG\" >> $GITHUB_OUTPUT\n"
},
{
"name": "Create GitHub release and upload artifacts",
"uses": "softprops/action-gh-release@v2",
"with": {
"files": "assets/*\nsha256\n",
"make_latest": true,
"tag_name": "${{ steps.create_tag.outputs.release_tag }}"
}
}
]
}
},
"name": "master",
"name": "main",
"on": {
"push": {
"branches": [
"main",
"master"
"main"
]
}
}
Expand Down
Loading
Loading