Skip to content
Latchkey

check-generated-pyi workflow (dot-agent/nextpy)

The check-generated-pyi workflow from dot-agent/nextpy, explained and optimized by Latchkey.

A

CI health: A - excellent

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

Grade your own workflow free or run it on Latchkey →
Source: dot-agent/nextpy.github/workflows/check_generated_pyi.ymlLicense Apache-2.0View source

What it does

This is the check-generated-pyi workflow from the dot-agent/nextpy 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: check-generated-pyi

on:
  push:
    branches: [ "main" ]
    # We don't just trigger on pyi_generator.py and the components dir, because
    # there are other things that can change the generator output
    # e.g. black version, nextpy.Component, nextpy.Var.
    paths-ignore:
      - '**/*.md'
  pull_request:
    branches: [ "main" ]
    paths-ignore:
      - '**/*.md'

jobs:
  check-generated-pyi-components:
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/setup_build_env
        with:
          python-version: "3.11.5"
          run-poetry-install: true
          create-venv-at-path: .venv
      - run: |
          poetry run python scripts/pyi_generator.py
          if git diff; then
            echo "No diffs - AOK!"
          else
            echo "ERROR: pyi_generator.py output is out of date. Please run scripts/pyi_generator.py and commit the changes."
          fi

The same workflow, on Latchkey

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

name: check-generated-pyi
 
on:
  push:
    branches: [ "main" ]
    # We don't just trigger on pyi_generator.py and the components dir, because
    # there are other things that can change the generator output
    # e.g. black version, nextpy.Component, nextpy.Var.
    paths-ignore:
      - '**/*.md'
  pull_request:
    branches: [ "main" ]
    paths-ignore:
      - '**/*.md'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  check-generated-pyi-components:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/setup_build_env
        with:
          python-version: "3.11.5"
          run-poetry-install: true
          create-venv-at-path: .venv
      - run: |
          poetry run python scripts/pyi_generator.py
          if git diff; then
            echo "No diffs - AOK!"
          else
            echo "ERROR: pyi_generator.py output is out of date. Please run scripts/pyi_generator.py and commit the changes."
          fi

What changed

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