Skip to content
Latchkey LogoLatchkey home

Code Checks workflow (pandas-dev/pandas)

The Code Checks workflow from pandas-dev/pandas, explained and optimized by Latchkey.

Source: pandas-dev/pandas.github/workflows/code-checks.ymlLicense BSD-3-ClauseView source
C
CI health grade
69/100
Health score
4
Jobs per trigger
3
Fixes in the optimized version

In short

  1. CI health: C (fair)
  2. The optimized version below points runs-on at Latchkey managed runners and adds run de-duplication and job timeouts.

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.

workflow (.yml), optimized
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: ubuntu-24.04
    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: ubuntu-24.04
    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: ubuntu-24.04
    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: ubuntu-24.04
    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

  1. Run on Latchkey managed runners with one line (runs-on), which apply the fixes below automatically and self-heal transient failures. Each Linux x64 job moves to the Latchkey size matching its vCPU count, latchkey-small for a standard 2 vCPU runner; macOS, Windows and arm64 jobs stay as written.
  2. Cancel superseded runs when a branch or PR gets a newer push.
  3. Add a job timeout so a hung step cannot burn hours of runner time.

This workflow runs 4 jobs per trigger. All of them run on a standard GitHub-hosted Linux x64 runner, which in a private repository bills $0.006 a minute against $0.0025 on latchkey-small, 58% lower; in a public repository like this one they are free. Estimate the monthly difference with your own run counts.

Actions used in this workflow

  • actions/checkout
  • actions/setup-python

Frequently asked questions

What does the Code Checks workflow (pandas-dev/pandas) workflow do?
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.
What CI health grade does this workflow get?
This Python workflow grades C. Paste your own workflow into the Latchkey grader to see its grade and the exact fixes.
How can I improve this Python workflow?
Add run de-duplication and job timeouts. Latchkey applies these automatically on managed runners when you point runs-on at Latchkey.

References