Skip to content
Latchkey

Deploy tfg-nightly to pypi workflow (tensorflow/graphics)

The Deploy tfg-nightly to pypi workflow from tensorflow/graphics, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, 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/graphics.github/workflows/tfg-nightly-pypi.ymlLicense Apache-2.0View source

What it does

This is the Deploy tfg-nightly to pypi workflow from the tensorflow/graphics 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)
# Publishes tfg-nightly
name: Deploy tfg-nightly to pypi

on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    # runs daily at 00:30 am
    - cron:  '30 0 * * *'

jobs:
  deploy:
    if: github.repository == 'tensorflow/graphics'  # prevents action from running on forks
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.8
    - name: Install system dependencies
      run: |
        sudo xargs apt-get update
        sudo xargs apt-get -y install < requirements.unix
    - name: Install pip requirements
      run: |
        python -m pip install --upgrade pip
        pip install -U -r requirements.txt
        pip install -U pytest
        pip install -U setuptools wheel
        pip install -U twine
    - name: Build ops
      run: |
        bazel build tensorflow_graphics/... --define=BASEDIR=$(pwd) --sandbox_writable_path=$(pwd)
        bazel clean --expunge
    - name: Run python tests
      env:
        MESA_GL_VERSION_OVERRIDE: 4.5
        MESA_GLSL_VERSION_OVERRIDE: 450
      run: |
        pytest tensorflow_graphics
    - name: Build pip package and install
      run: |
        python setup.py sdist bdist_wheel --nightly
        pip install dist/*.whl
    - name: Test install
      run: |
        cd $(mktemp -d) && python -c 'import tensorflow_graphics as tfg'
    - name: Publish to PyPi # https://pypi.org/project/tfg-nightly
      env:
        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
      run: |
        twine upload dist/*

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

# Publishes tfg-nightly
name: Deploy tfg-nightly to pypi
 
on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    # runs daily at 00:30 am
    - cron:  '30 0 * * *'
 
jobs:
  deploy:
    timeout-minutes: 30
    if: github.repository == 'tensorflow/graphics'  # prevents action from running on forks
    runs-on: latchkey-small
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        cache: 'pip'
        python-version: 3.8
    - name: Install system dependencies
      run: |
        sudo xargs apt-get update
        sudo xargs apt-get -y install < requirements.unix
    - name: Install pip requirements
      run: |
        python -m pip install --upgrade pip
        pip install -U -r requirements.txt
        pip install -U pytest
        pip install -U setuptools wheel
        pip install -U twine
    - name: Build ops
      run: |
        bazel build tensorflow_graphics/... --define=BASEDIR=$(pwd) --sandbox_writable_path=$(pwd)
        bazel clean --expunge
    - name: Run python tests
      env:
        MESA_GL_VERSION_OVERRIDE: 4.5
        MESA_GLSL_VERSION_OVERRIDE: 450
      run: |
        pytest tensorflow_graphics
    - name: Build pip package and install
      run: |
        python setup.py sdist bdist_wheel --nightly
        pip install dist/*.whl
    - name: Test install
      run: |
        cd $(mktemp -d) && python -c 'import tensorflow_graphics as tfg'
    - name: Publish to PyPi # https://pypi.org/project/tfg-nightly
      env:
        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
      run: |
        twine upload dist/*
 

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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow