Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17

common --enable_platform_specific_config

# Don't inherit the user environment as that trashes the cache.
build --incompatible_strict_action_env
# Use the new way of defining toolchains.
Expand Down Expand Up @@ -35,7 +37,13 @@ build:remote-exec --extra_toolchains=//tools/remote-toolchains:all
build:remote-ubuntu-22-04 --config=remote-exec
build:remote-ubuntu-22-04 --extra_execution_platforms=//tools/remote-toolchains:ubuntu-act-22-04-platform

# Workaround https://github.com/bazelbuild/bazel/issues/19733
common:remote-exec-windows --features=-parse_showincludes --host_features=-parse_showincludes

# When running bare executors on your own host machine.
build:remote-local --config=remote-exec

common --incompatible_enable_proto_toolchain_resolution

# Required to make protobuf compile on Windows
common:windows --define=protobuf_allow_msvc=true
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.0.1
8.3.1
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# jsonnet fails to recognise blank lines with windows line endings,
# so you get errors like:
# monitoring\prometheus\recording-rules.jsonnet:103:17
# Text block's first line must start with whitespace
# Instead we disable all line ending translation.
* -text
164 changes: 130 additions & 34 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
@@ -1,111 +1,207 @@
{
"jobs": {
"build_and_test": {
"runs-on": "ubuntu-latest",
"name": "build_and_test ${{ matrix.host.os }}",
"runs-on": "${{ matrix.host.os }}",
"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"
},
{
"name": "Check out source code",
"uses": "actions/checkout@v1"
"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}"
"run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-${{matrix.host.bazel_os}}-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}",
"shell": "bash"
},
{
"if": "matrix.host.platform_name == 'windows_amd64'",
"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": "bazel run //: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 //:buildifier.check"
"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"
},
{
"name": "Check the diff between docker-compose and Kubernetes configs",
"run": "tools/diff-docker-and-k8s-configs.sh > tools/expected-docker-and-k8s-configs.diff"
"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"
},
{
"name": "Update versions of the container images",
"run": "tools/update-container-image-versions.sh"
"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 diff --exit-code HEAD --"
"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)/..."
},
{
"name": "Test bare deployment",
"run": "tools/test-deployment-bare.sh"
"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 //..."
},
{
"name": "Test docker-compose deployment",
"run": "tools/test-deployment-docker-compose.sh"
"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 //..."
},
{
"name": "Test Kubernetes deployment",
"run": "tools/test-deployment-kubernetes"
"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 //..."
},
{
"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 //..."
},
{
"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 //..."
},
{
"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 //..."
},
{
"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 //..."
},
{
"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 //..."
},
{
"if": "matrix.host.lint",
"name": "bazel mod integrity",
"run": "bazel mod graph || true"
},
{
"name": "linux_amd64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_amd64 //..."
"if": "matrix.host.lint",
"name": "Check the diff between docker-compose and Kubernetes configs",
"run": "tools/diff-docker-and-k8s-configs.sh > tools/expected-docker-and-k8s-configs.diff"
},
{
"name": "linux_386: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_386 //..."
"if": "matrix.host.lint",
"name": "Update versions of the container images",
"run": "tools/update-container-image-versions.sh"
},
{
"name": "linux_arm: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm //..."
"if": "matrix.host.lint",
"name": "Test bb-deployments style conformance",
"run": "git diff --exit-code HEAD --"
},
{
"name": "linux_arm64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm64 //..."
"if": "matrix.host.platform_name != 'windows_amd64'",
"name": "Test bare deployment (Unix)",
"run": "tools/test-deployment-bare.sh",
"shell": "bash"
},
{
"name": "darwin_amd64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
"if": "matrix.host.platform_name == 'windows_amd64'",
"name": "Test bare deployment (Windows)",
"run": "tools/run-with-console.ps1 -Command 'bash.exe -c ./tools/test-deployment-bare.sh'"
},
{
"name": "darwin_arm64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
"if": "matrix.host.platform_name == 'linux_amd64'",
"name": "Test docker-compose deployment",
"run": "tools/test-deployment-docker-compose.sh"
},
{
"name": "freebsd_amd64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //..."
"if": "matrix.host.platform_name == 'linux_amd64'",
"name": "Test Kubernetes deployment",
"run": "tools/test-deployment-kubernetes"
},
{
"name": "windows_amd64: build and test",
"run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //..."
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
},
"if": "matrix.host.upload",
"name": "Install Docker credentials",
"run": "echo \"${GITHUB_TOKEN}\" | docker login ghcr.io -u $ --password-stdin"
}
]
],
"strategy": {
"matrix": {
"host": [
{
"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
}
]
}
}
}
},
"name": "master",
"on": {
"push": {
"branches": [
"main",
"master"
]
}
Expand Down
Loading
Loading