Skip to content
Latchkey

Nightly workflow (keras-team/keras-hub)

The Nightly workflow from keras-team/keras-hub, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: keras-team/keras-hub.github/workflows/nightly.ymlLicense Apache-2.0View source

What it does

This is the Nightly workflow from the keras-team/keras-hub 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)
name: Nightly

on:
  workflow_dispatch: # To Generate wheels on demand outside of schedule.
  schedule:
    - cron: '0 3 * * *' # run at 3 AM UTC / 8 PM PDT

permissions:
  contents: read

jobs:
  run-test-for-nightly:
    uses: ./.github/workflows/actions.yml
  nightly:
    name: Build Wheel file and upload
    needs: [run-test-for-nightly]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.11'
      - name: Get pip cache dir
        id: pip-cache
        run: |
          python -m pip install --upgrade pip setuptools
          echo "::set-output name=dir::$(pip cache dir)"
      - name: pip cache
        uses: actions/cache@v6
        with:
          path: ${{ steps.pip-cache.outputs.dir }}
          key: ${{ runner.os }}-pip-${{ hashFiles('requirements-common.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('pyproject.toml') }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip setuptools
          pip install twine
          pip install -r requirements.txt --progress-bar off
      - name: Build wheel file
        run: |
          python pip_build.py --nightly
      - name: Publish KerasHub Nightly to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          password: ${{ secrets.PYPI_NIGHTLY_API_TOKEN_HUB }}
          verbose: true
      - name: Publish KerasNLP Nightly to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          packages-dir: keras_nlp/dist/
          password: ${{ secrets.PYPI_NIGHTLY_API_TOKEN }}
          verbose: true

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.

name: Nightly
 
on:
  workflow_dispatch: # To Generate wheels on demand outside of schedule.
  schedule:
    - cron: '0 3 * * *' # run at 3 AM UTC / 8 PM PDT
 
permissions:
  contents: read
 
jobs:
  run-test-for-nightly:
    timeout-minutes: 30
    uses: ./.github/workflows/actions.yml
  nightly:
    timeout-minutes: 30
    name: Build Wheel file and upload
    needs: [run-test-for-nightly]
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v7
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          cache: 'pip'
          python-version: '3.11'
      - name: Get pip cache dir
        id: pip-cache
        run: |
          python -m pip install --upgrade pip setuptools
          echo "::set-output name=dir::$(pip cache dir)"
      - name: pip cache
        uses: actions/cache@v6
        with:
          path: ${{ steps.pip-cache.outputs.dir }}
          key: ${{ runner.os }}-pip-${{ hashFiles('requirements-common.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('pyproject.toml') }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip setuptools
          pip install twine
          pip install -r requirements.txt --progress-bar off
      - name: Build wheel file
        run: |
          python pip_build.py --nightly
      - name: Publish KerasHub Nightly to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          password: ${{ secrets.PYPI_NIGHTLY_API_TOKEN_HUB }}
          verbose: true
      - name: Publish KerasNLP Nightly to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          packages-dir: keras_nlp/dist/
          password: ${{ secrets.PYPI_NIGHTLY_API_TOKEN }}
          verbose: true
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

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

Actions used in this workflow