bazel: speed up CI #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "build and test" | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
concurrency: | |
# Cancel previous actions from the same PR or branch except 'main' branch. | |
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info. | |
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}} | |
cancel-in-progress: ${{ github.ref_name != 'main' }} | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bazelbuild/setup-bazelisk@v1 | |
- name: Mount bazel caches | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bazel-disk-cache | |
~/.cache/bazel-repository-cache | |
~/.cache/xdg-cache | |
key: bazel-cache | |
restore-keys: bazel-cache | |
- name: Configure bazel | |
run: | | |
echo "import %workspace%/.github/workflow/ci.bazelrc" >>.bazelrc.user | |
- run: bazel build //... && bazel test //... | |
# TODO: deprecate by Jan 2025 https://bazel.build/release | |
build-e2e-bazel-5: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: bazelbuild/setup-bazelisk@v1 | |
- run: cd e2e/bazel-5 && bazel build //... | |
build-e2e-bazel-6-nobzlmod: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: bazelbuild/setup-bazelisk@v1 | |
- run: cd e2e/bazel-6 && bazel build //... | |
build-e2e-bazel-6-bzlmod: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: bazelbuild/setup-bazelisk@v1 | |
- run: cd e2e/bazel-6-bzlmod && bazel build //... | |
build-e2e-bazel-7-nobzlmod: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: bazelbuild/setup-bazelisk@v1 | |
- run: cd e2e/bazel-7 && bazel build //... |