Skip to content

Commit

Permalink
feat: use multiple remote services on CI (#56)
Browse files Browse the repository at this point in the history
* feat: use multiple remote services on CI

Signed-off-by: Thulio Ferraz Assis <[email protected]>

* fix: disable EngFlow temporarily

Signed-off-by: Thulio Ferraz Assis <[email protected]>
  • Loading branch information
f0rmiga authored Jun 23, 2022
1 parent 177dbb4 commit 124088a
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 43 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/.bazelrc.ci
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
build --keep_going

# Remote cache
build --bes_backend=grpcs://tourmaline.cluster.engflow.com
build --bes_results_url=https://tourmaline.cluster.engflow.com/invocation/
build --remote_cache=grpcs://tourmaline.cluster.engflow.com
# Generic remote cache
build --remote_download_toplevel
build --remote_timeout=3600
build --remote_upload_local_results
build --tls_client_certificate=tourmaline-client.crt
build --tls_client_key=tourmaline-client.key

# Remote build execution
# Generic remote build execution
build:rbe --extra_execution_platforms=//platforms:x86_64_linux_remote
build:rbe --genrule_strategy=remote
build:rbe --host_platform=//platforms:x86_64_linux_remote
build:rbe --jobs=32
build:rbe --remote_executor=grpcs://tourmaline.cluster.engflow.com

# EngFlow remote cache
build:engflow --bes_backend=grpcs://tourmaline.cluster.engflow.com
build:engflow --bes_results_url=https://tourmaline.cluster.engflow.com/invocation/
build:engflow --remote_cache=grpcs://tourmaline.cluster.engflow.com

# EngFlow remote build execution
build:engflow_rbe --remote_executor=grpcs://tourmaline.cluster.engflow.com

# BuildBuddy remote cache
build:buildbuddy --bes_backend=grpcs://remote.buildbuddy.io
build:buildbuddy --bes_results_url=https://app.buildbuddy.io/invocation/
build:buildbuddy --remote_cache=grpcs://remote.buildbuddy.io

# BuildBuddy remote build execution
build:buildbuddy_rbe --remote_executor=grpcs://remote.buildbuddy.io
12 changes: 12 additions & 0 deletions .github/workflows/buildbuddy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail

readonly GIT_ROOT=$(git rev-parse --show-toplevel)
cd "${GIT_ROOT}"

cp ".github/workflows/.bazelrc.ci" ".bazelrc.user"

bazel test \
--remote_header=x-buildbuddy-api-key="${BUILDBUDDY_API_KEY}" \
"$@"
88 changes: 53 additions & 35 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,62 @@ on:
workflow_dispatch:

jobs:
test:
distros:
if: ${{ github.ref == 'refs/heads/master' }} or ${{ github.event.label.name == 'ci-test' }}
strategy:
matrix:
remote:
- buildbuddy
# TODO(f0rmiga): re-enable once cluster is fixed.
# - engflow
os:
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
compilation_mode:
- fastbuild
- dbg
- opt
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: bazelbuild/setup-bazelisk@v1
- run: |-
set -o errexit -o nounset -o pipefail
cp .github/workflows/.bazelrc.ci .bazelrc.user
echo "${ENGFLOW_CLIENT_CRT}" > tourmaline-client.crt
chmod 0600 tourmaline-client.crt
echo "${ENGFLOW_PRIVATE_KEY}" > tourmaline-client.key
chmod 0600 tourmaline-client.key
- name: Test
run: ./.github/workflows/${{ matrix.remote }}.sh --config ${{ matrix.remote }} //...
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }}
ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }}
compilation_modes:
if: ${{ github.ref == 'refs/heads/master' }} or ${{ github.event.label.name == 'ci-test' }}
strategy:
matrix:
remote:
- buildbuddy
# TODO(f0rmiga): re-enable once cluster is fixed.
# - engflow
compilation_mode:
- fastbuild
- dbg
- opt
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: bazelbuild/setup-bazelisk@v1
- name: Test
run: |-
bazel test \
./.github/workflows/${{ matrix.remote }}.sh \
--config ${{ matrix.remote }} \
--compilation_mode ${{ matrix.compilation_mode }} \
//...
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }}
ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }}
sanitizers:
if: ${{ github.ref == 'refs/heads/master' }} or ${{ github.event.label.name == 'ci-test' }}
strategy:
matrix:
remote:
- buildbuddy
# TODO(f0rmiga): re-enable once cluster is fixed.
# - engflow
sanitizer:
- asan
- lsan
Expand All @@ -54,39 +75,36 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: bazelbuild/setup-bazelisk@v1
- run: |-
set -o errexit -o nounset -o pipefail
cp .github/workflows/.bazelrc.ci .bazelrc.user
echo "${ENGFLOW_CLIENT_CRT}" > tourmaline-client.crt
chmod 0600 tourmaline-client.crt
echo "${ENGFLOW_PRIVATE_KEY}" > tourmaline-client.key
chmod 0600 tourmaline-client.key
env:
ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }}
ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }}
- name: Test ${{ matrix.sanitizer }}
run: |-
bazel test \
./.github/workflows/${{ matrix.remote }}.sh \
--config ${{ matrix.remote }} \
--config ${{ matrix.sanitizer }} \
//tests/sanitizers:${{ matrix.sanitizer }}_test
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }}
ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }}
rbe:
if: ${{ github.ref == 'refs/heads/master' }} or ${{ github.event.label.name == 'ci-test' }}
strategy:
matrix:
remote:
- buildbuddy
# TODO(f0rmiga): re-enable once cluster is fixed.
# - engflow
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: bazelbuild/setup-bazelisk@v1
- run: |-
set -o errexit -o nounset -o pipefail
cp .github/workflows/.bazelrc.ci .bazelrc.user
echo "${ENGFLOW_CLIENT_CRT}" > tourmaline-client.crt
chmod 0600 tourmaline-client.crt
echo "${ENGFLOW_PRIVATE_KEY}" > tourmaline-client.key
chmod 0600 tourmaline-client.key
env:
ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }}
ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }}
- name: Test with RBE
run: |-
bazel test \
./.github/workflows/${{ matrix.remote }}.sh \
--config rbe \
--config ${{ matrix.remote }} \
--config ${{ matrix.remote }}_rbe \
//...
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }}
ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }}
29 changes: 29 additions & 0 deletions .github/workflows/engflow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail

readonly GIT_ROOT=$(git rev-parse --show-toplevel)
cd "${GIT_ROOT}"

cp ".github/workflows/.bazelrc.ci" ".bazelrc.user"

readonly crt_file="engflow.crt"
readonly key_file="engflow.key"
touch "${crt_file}"
touch "${key_file}"
chmod 0600 "${crt_file}"
chmod 0600 "${key_file}"
echo "${ENGFLOW_CLIENT_CRT}" > "${crt_file}"
echo "${ENGFLOW_PRIVATE_KEY}" > "${key_file}"

function on_exit {
rm -f "${crt_file}"
rm -f "${key_file}"
}

trap on_exit EXIT

bazel test \
--tls_client_certificate="${crt_file}" \
--tls_client_key="${key_file}" \
"$@"

0 comments on commit 124088a

Please sign in to comment.