Skip to content

Add docker build github action #21328

Add docker build github action

Add docker build github action #21328

Workflow file for this run

# Github action definitions for unit-tests with PRs.
name: tfx-unit-tests
on:
push:
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- 'docs/**'
workflow_dispatch:
env:
USE_BAZEL_VERSION: "6.5.0"
# Changed to match tensorflow
# https://github.com/tensorflow/tensorflow/blob/master/.bazelversion
jobs:
tests:
if: github.actor != 'copybara-service[bot]'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10']
which-tests: ["not e2e", "e2e"]
dependency-selector: ["NIGHTLY", "DEFAULT"]
steps:
- uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
setup.py
tfx/dependencies.py
- name: Set up Bazel
uses: bazel-contrib/[email protected]
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}-${{ hashFiles('.github/workflows/ci-test.yml') }}
# Share repository cache between workflows.
repository-cache: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
# TODO(b/232490018): Cython need to be installed separately to build pycocotools.
python -m pip install Cython -c ./test_constraints.txt
pip install \
-c ./${{ matrix.dependency-selector == 'NIGHTLY' && 'nightly_test_constraints.txt' || 'test_constraints.txt' }} \
--extra-index-url https://pypi-nightly.tensorflow.org/simple --pre .[all]
env:
TFX_DEPENDENCY_SELECTOR: ${{ matrix.dependency-selector }}
- name: Run unit tests
shell: bash
run: |
pytest -m "${{ matrix.which-tests }}"