Skip to content

Enable gha

Enable gha #5

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 .
- name: define pytest testing matrix
id: set-matrix
run: |
echo "matrix=$(python3 .github/workflows/set_matrix.py)" >> $GITHUB_OUTPUT
build-and-test:
needs: pre-commit
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.pre-commit.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and Test
env:
PYTEST_FILES: ${{ matrix.pytest_files }}
SKIP_PRECOMMIT: --skip-pre-commit
run: |
docker build \
--build-arg "PYTEST_FILES=$PYTEST_FILES" \
--build-arg "SKIP_PRECOMMIT=$SKIP_PRECOMMIT" \
-t mydockertarget --target=ci .