Skip to content

Internal

Internal #154

Workflow file for this run

name: Build and test
on:
# Only run workflow on pushes to main (includes PR merge), and on
# opened pull-requests.
push:
branches:
- main
pull_request:
jobs:
build-and-test-cpu:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
. build/install_bazelisk.sh
# Load different caches depending on if this is a pull-request or merge.
# If merge (or push commit), use a read-write cache based on the python
# version, branch, and commit-sha.
# If pull-request, use a read-only cache based on the target python
# version, branch, and PR base sha.
- if: github.event_name != 'pull_request'
name: Mount bazel cache (main)
uses: actions/cache@v4
with:
path: "/home/runner/.cache/bazel"
key: bazel-py3.10-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
bazel-py3.10-${{ github.ref_name }}
bazel-py3.10-
bazel-
- if: github.event_name == 'pull_request'
name: Mount bazel cache (pull-request)
uses: actions/cache/restore@v4
with:
path: "/home/runner/.cache/bazel"
key: bazel-py3.10-${{ github.base_ref }}-${{ github.event.pull_request.base.sha }}
restore-keys: |
bazel-py3.10-${{ github.base_ref }}
bazel-py3.10-
bazel-
- name: Build all targets
run: |
export HERMETIC_PYTHON_VERSION=3.10
bazel build //...
- name: Build pip wheel
run: |
bazel run //build:build_pip_package -- $PWD
- name: Run CPU tests
run: |
bazel test --test_tag_filters=-requires-tpu --test_output=errors --keep_going //...