Skip to content

Add docker builder step in github action #21283

Add docker builder step in github action

Add docker builder step in github action #21283

Workflow file for this run

# Github action definitions for unit-tests with PRs.
name: tfx-unit-tests
on:
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: 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
# TODO(b/232490018): Cython need to be installed separately to build pycocotools.
python -m pip install Cython -c ./test_constraints.txt
pip install -c ./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 }}"
- name: Build docker image
run: |
export image_repo="gcr.io/tfx-testing/ai-platform-pipelines-e2e-test"
export image_tag="$(date +%s)-$(LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c 10)"
export image_name="${image_repo}:${image_tag}"
TFX_DEPENDENCY_SELECTOR=DEFAULT \
DOCKER_IMAGE_REPO="${image_repo}" \
DOCKER_IMAGE_TAG="${image_tag}" \
tfx/tools/docker/build_docker_image.sh