63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
name: Build and Test with Bazel
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, unlabeled]
|
|
|
|
jobs:
|
|
build:
|
|
if: github.event.action != 'unlabeled' || github.event.label.name == 'kokoro:run'
|
|
timeout-minutes: 120
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-2025]
|
|
|
|
runs-on: ${{matrix.os}}
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
fetch-depth: '0'
|
|
persist-credentials: false
|
|
- name: Download dependencies
|
|
run: python3 utils/git-sync-deps
|
|
- name: Mount Bazel cache
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ~/.bazel/cache
|
|
# Force a new cache version by updating the number in 'generationN'
|
|
key: bazel-cache-${{ runner.os }}-generation3
|
|
- name: Build All
|
|
run: bazel --output_user_root=~/.bazel/cache build //...
|
|
- name: Test All
|
|
run: bazel --output_user_root=~/.bazel/cache test --test_output=errors //...
|
|
|
|
# iOS is 10x expensive to run on GitHub machines, so only run if we know something else passed
|
|
# The steps are unfortunately duplicated because github actions requires 2 jobs for a dependency
|
|
build-macos:
|
|
needs: build
|
|
timeout-minutes: 120
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
fetch-depth: '0'
|
|
persist-credentials: false
|
|
- name: Download dependencies
|
|
run: python3 utils/git-sync-deps
|
|
- name: Mount Bazel cache
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: ~/.bazel/cache
|
|
key: bazel-cache-${{ runner.os }}
|
|
- name: Build All
|
|
run: bazel --output_user_root=~/.bazel/cache build //...
|
|
- name: Test All
|
|
run: bazel --output_user_root=~/.bazel/cache test --test_output=errors //...
|