Skip to content

Enable gha

Enable gha #10

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
pull_request:
jobs:
pre-commit:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
# TODO(markblee): Remove gcp,vertexai_tensorboard from CI. (needed by pytype)
pip install '.[dev,gcp,vertexai_tensorboard]'
- name: Run pre-commit
run: pre-commit run --all-files
- name: Run pytype
run: pytype -j auto .
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: define pytest testing matrix
id: set-matrix
run: |
echo "matrix=$(python3 .github/workflows/set_matrix.py)" >> $GITHUB_OUTPUT
build-and-test:
needs: set-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
target: ci
build-args: |
PYTEST_FILES=${{ matrix.pytest_files }}
SKIP_PRECOMMIT=--skip-pre-commit