F0 style checking workflow (foundryzero/llef)
The F0 style checking workflow from foundryzero/llef, explained and optimized by Latchkey.
CI health: F - at risk
Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the F0 style checking workflow from the foundryzero/llef repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: F0 style checking
run-name: Running style checks on ${{ github.ref_name }} following push by ${{ github.actor }}
on: push
jobs:
Check-isort:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: python-isort
uses: isort/isort-action@v1.1.1
with:
configuration: "--check-only --profile black --diff --verbose"
# Check-mypy:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: python-mypy
# uses: jpetrucciani/mypy-check@master
# with:
# path: '.'
# mypy_flags: '--config-file .mypy.ini'
Check-black:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: python-black
uses: psf/black@stable
with:
options: "--check --line-length=120"
src: "."
Check-flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: flake8 Lint
uses: py-actions/flake8@v2.3.0
with:
max-line-length: "120"
path: "."
ignore: "E203,W503"
# Check-pydocstyle:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: pydocstyle
# uses: foundryzero/pydocstyle-action@v1.2.6
# with:
# path: "."
# Check-pylint:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: pylint
# uses: foundryzero/pylint-action@v1.0.6
# with:
# match: "binder_trace/**/*.py"
# requirements_file: "binder_trace/requirements.txt"
Check-tox:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
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: F0 style checking run-name: Running style checks on ${{ github.ref_name }} following push by ${{ github.actor }} on: push concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: Check-isort: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v3 - name: python-isort uses: isort/isort-action@v1.1.1 with: configuration: "--check-only --profile black --diff --verbose" # Check-mypy: # runs-on: latchkey-small # steps: # - name: Checkout # uses: actions/checkout@v3 # - name: python-mypy # uses: jpetrucciani/mypy-check@master # with: # path: '.' # mypy_flags: '--config-file .mypy.ini' Check-black: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v3 - name: python-black uses: psf/black@stable with: options: "--check --line-length=120" src: "." Check-flake8: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v3 - name: Set up Python environment uses: actions/setup-python@v4 with: cache: 'pip' python-version: "3.11" - name: flake8 Lint uses: py-actions/flake8@v2.3.0 with: max-line-length: "120" path: "." ignore: "E203,W503" # Check-pydocstyle: # runs-on: latchkey-small # steps: # - name: Checkout # uses: actions/checkout@v3 # - name: pydocstyle # uses: foundryzero/pydocstyle-action@v1.2.6 # with: # path: "." # Check-pylint: # runs-on: latchkey-small # steps: # - name: Checkout # uses: actions/checkout@v3 # - name: pylint # uses: foundryzero/pylint-action@v1.0.6 # with: # match: "binder_trace/**/*.py" # requirements_file: "binder_trace/requirements.txt" Check-tox: timeout-minutes: 30 runs-on: latchkey-small strategy: matrix: python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: cache: 'pip' python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install tox tox-gh-actions - name: Test with tox run: tox
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.
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
6 third-party actions are referenced by a movable tag. Pin them 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:
- Dependency installs
This workflow runs 4 jobs (8 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.