Code Checks workflow (pandas-dev/pandas)
The Code Checks workflow from pandas-dev/pandas, explained and optimized by Latchkey.
C
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Code Checks workflow from the pandas-dev/pandas repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: Code Checks
on:
push:
branches:
- main
- 3.0.x
pull_request:
branches:
- main
- 3.0.x
defaults:
run:
shell: bash -euox pipefail {0}
permissions: {}
jobs:
doctest:
name: Doctests
runs-on: ubuntu-24.04
permissions:
contents: read
concurrency:
# https://github.community/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-doctests
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Create virtual environment with Pixi
uses: ./.github/actions/setup-pixi
with:
environment: "doctests"
- name: Build pandas
run: |
pixi run \
--environment doctests \
build-pandas \
--editable \
-Csetup-args="--werror"
- name: Run doctests
run: pixi run --environment doctests ci-doctests
- name: Run scripts tests
run: pixi run --environment doctests ci-scripts-tests
type-checking:
name: Type Checking
runs-on: ubuntu-24.04
permissions:
contents: read
concurrency:
# https://github.community/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-typechecking
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Create virtual environment with Pixi
uses: ./.github/actions/setup-pixi
with:
environment: "typing"
- name: Build pandas
run: |
pixi run \
--environment typing \
build-pandas \
--editable \
-Csetup-args="--werror"
- name: Typing Checks
run: pixi run --environment typing ci-typing
asv-benchmarks:
name: ASV Benchmarks
runs-on: ubuntu-24.04
permissions:
contents: read
concurrency:
# https://github.community/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-asv-benchmarks
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Create virtual environment with Pixi
uses: ./.github/actions/setup-pixi
with:
environment: "asv"
- name: Build pandas
run: |
pixi run \
--environment asv \
build-pandas \
--editable \
-Csetup-args="--werror"
- name: Run ASV benchmarks
run: pixi run --environment asv ci-asv
requirements-dev-text-installable:
name: Test install requirements-dev.txt
runs-on: ubuntu-24.04
permissions:
contents: read
concurrency:
# https://github.community/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-requirements-dev-text-installable
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Python
id: setup_python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.11'
cache: 'pip'
pip-install: '-r requirements-dev.txt'
cache-dependency-path: 'requirements-dev.txt'
- name: Check Pip Cache Hit
run: echo ${{ steps.setup_python.outputs.cache-hit }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Code Checks on: push: branches: - main - 3.0.x pull_request: branches: - main - 3.0.x defaults: run: shell: bash -euox pipefail {0} permissions: {} concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: doctest: timeout-minutes: 30 name: Doctests runs-on: latchkey-small permissions: contents: read concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-doctests cancel-in-progress: true steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 - name: Create virtual environment with Pixi uses: ./.github/actions/setup-pixi with: environment: "doctests" - name: Build pandas run: | pixi run \ --environment doctests \ build-pandas \ --editable \ -Csetup-args="--werror" - name: Run doctests run: pixi run --environment doctests ci-doctests - name: Run scripts tests run: pixi run --environment doctests ci-scripts-tests type-checking: timeout-minutes: 30 name: Type Checking runs-on: latchkey-small permissions: contents: read concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-typechecking cancel-in-progress: true steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 - name: Create virtual environment with Pixi uses: ./.github/actions/setup-pixi with: environment: "typing" - name: Build pandas run: | pixi run \ --environment typing \ build-pandas \ --editable \ -Csetup-args="--werror" - name: Typing Checks run: pixi run --environment typing ci-typing asv-benchmarks: timeout-minutes: 30 name: ASV Benchmarks runs-on: latchkey-small permissions: contents: read concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-asv-benchmarks cancel-in-progress: true steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 - name: Create virtual environment with Pixi uses: ./.github/actions/setup-pixi with: environment: "asv" - name: Build pandas run: | pixi run \ --environment asv \ build-pandas \ --editable \ -Csetup-args="--werror" - name: Run ASV benchmarks run: pixi run --environment asv ci-asv requirements-dev-text-installable: timeout-minutes: 30 name: Test install requirements-dev.txt runs-on: latchkey-small permissions: contents: read concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-requirements-dev-text-installable cancel-in-progress: true steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Setup Python id: setup_python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: '3.11' cache: 'pip' pip-install: '-r requirements-dev.txt' cache-dependency-path: 'requirements-dev.txt' - name: Check Pip Cache Hit run: echo ${{ steps.setup_python.outputs.cache-hit }}
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.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 4 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.