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.
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."
fiThe 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
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.