Skip to content
Latchkey

tft-unit-tests workflow (tensorflow/transform)

The tft-unit-tests workflow from tensorflow/transform, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: tensorflow/transform.github/workflows/ci-test.ymlLicense Apache-2.0View source

What it does

This is the tft-unit-tests workflow from the tensorflow/transform repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# Github action definitions for unit-tests with PRs.

name: tft-unit-tests
on:
  pull_request:
    branches: [ master ]
    paths-ignore:
      - '**.md'
      - 'docs/**'
  workflow_dispatch:

env:
  USE_BAZEL_VERSION: 7.7.0

jobs:
  unit-tests:
    if: github.actor != 'copybara-service[bot]'
    runs-on: ubuntu-latest

    strategy:
      matrix:
        python-version: ['3.10', '3.11', '3.12', '3.13']

    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

    - name: Install dependencies
      run: |
        sudo apt update
        sudo apt install -y protobuf-compiler
        pip install --upgrade pip setuptools wheel numpy pyarrow
        pip install --no-build-isolation .[test]

    - name: Run unit tests
      shell: bash
      run: |
        pytest

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

# Github action definitions for unit-tests with PRs.
 
name: tft-unit-tests
on:
  pull_request:
    branches: [ master ]
    paths-ignore:
      - '**.md'
      - 'docs/**'
  workflow_dispatch:
 
env:
  USE_BAZEL_VERSION: 7.7.0
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  unit-tests:
    timeout-minutes: 30
    if: github.actor != 'copybara-service[bot]'
    runs-on: latchkey-small
 
    strategy:
      matrix:
        python-version: ['3.10', '3.11', '3.12', '3.13']
 
    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
 
    - name: Install dependencies
      run: |
        sudo apt update
        sudo apt install -y protobuf-compiler
        pip install --upgrade pip setuptools wheel numpy pyarrow
        pip install --no-build-isolation .[test]
 
    - name: Run unit tests
      shell: bash
      run: |
        pytest
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job (4 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow