| 1 |
name: Build and Test with Bazel |
| 2 |
permissions: |
| 3 |
contents: read |
| 4 |
|
| 5 |
on: |
| 6 |
push: |
| 7 |
branches: |
| 8 |
- 'main' |
| 9 |
pull_request: |
| 10 |
types: [opened, synchronize, reopened, unlabeled] |
| 11 |
|
| 12 |
jobs: |
| 13 |
build: |
| 14 |
if: github.event.action != 'unlabeled' || github.event.label.name == 'kokoro:run' |
| 15 |
timeout-minutes: 120 |
| 16 |
strategy: |
| 17 |
matrix: |
| 18 |
os: [ubuntu-latest, windows-2025] |
| 19 |
|
| 20 |
runs-on: ${{matrix.os}} |
| 21 |
|
| 22 |
steps: |
| 23 |
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 24 |
with: |
| 25 |
fetch-depth: '0' |
| 26 |
- name: Download dependencies |
| 27 |
run: python3 utils/git-sync-deps |
| 28 |
- name: Mount Bazel cache |
| 29 |
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 |
| 30 |
with: |
| 31 |
path: ~/.bazel/cache |
| 32 |
key: bazel-cache-${{ runner.os }} |
| 33 |
- name: Build All |
| 34 |
run: bazel --output_user_root=~/.bazel/cache build //... |
| 35 |
- name: Test All |
| 36 |
run: bazel --output_user_root=~/.bazel/cache test --test_output=errors //... |
| 37 |
|
| 38 |
# iOS is 10x expensive to run on GitHub machines, so only run if we know something else passed |
| 39 |
# The steps are unfortunately duplicated because github actions requires 2 jobs for a dependency |
| 40 |
build-macos: |
| 41 |
needs: build |
| 42 |
timeout-minutes: 120 |
| 43 |
runs-on: macos-latest |
| 44 |
|
| 45 |
steps: |
| 46 |
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 47 |
with: |
| 48 |
fetch-depth: '0' |
| 49 |
- name: Download dependencies |
| 50 |
run: python3 utils/git-sync-deps |
| 51 |
- name: Mount Bazel cache |
| 52 |
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 |
| 53 |
with: |
| 54 |
path: ~/.bazel/cache |
| 55 |
key: bazel-cache-${{ runner.os }} |
| 56 |
- name: Build All |
| 57 |
run: bazel --output_user_root=~/.bazel/cache build //... |
| 58 |
- name: Test All |
| 59 |
run: bazel --output_user_root=~/.bazel/cache test --test_output=errors //... |