Skip to content
Latchkey

cd-docs workflow (mpi4py/mpi4py)

The cd-docs workflow from mpi4py/mpi4py, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: mpi4py/mpi4py.github/workflows/cd-docs.ymlLicense BSD-3-ClauseView source

What it does

This is the cd-docs workflow from the mpi4py/mpi4py 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: cd-docs

on:  # yamllint disable-line rule:truthy
  workflow_call:
  workflow_dispatch:

permissions:
  contents: read

jobs:

  docs:
    runs-on: ubuntu-latest
    steps:

    - uses: step-security/harden-runner@v2
      with:
        egress-policy: audit

    - id: checkout
      uses: actions/checkout@v7

    - id: source-date-epoch
      run: |
        # source-date-epoch
        SOURCE_DATE_EPOCH=$(git log -1 --pretty=%at)
        echo SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH >> $GITHUB_ENV
        echo $(git log -1 --pretty=%ai) [timestamp=$SOURCE_DATE_EPOCH]
      shell: bash

    - id: setup-latex
      run: |
        # setup-latex
        sudo apt update && \
        sudo apt install -y \
           texlive-latex-base \
           texlive-latex-recommended \
           texlive-latex-extra \
           latexmk \
           texinfo

    - id: setup-python
      uses: actions/setup-python@v6
      with:
        python-version: 3
        pip-install: tox

    - id: build
      run: python -m tox run -m docs

    - id: archive
      run:  |
        archive=mpi4py-docs.zip
        rootdir=${archive%.zip}
        ln -s docs $rootdir
        python conf/metadata.py version > $rootdir/version
        python -m zipfile -c $archive $rootdir

    - id: upload
      uses: actions/upload-artifact@v7
      with:
        name: docs
        path: mpi4py-docs.zip

    - id: report
      run: |
        artifact='Artifact: <${{ steps.upload.outputs.artifact-url }}>'

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: cd-docs
 
on:  # yamllint disable-line rule:truthy
  workflow_call:
  workflow_dispatch:
 
permissions:
  contents: read
 
jobs:
 
  docs:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
 
    - uses: step-security/harden-runner@v2
      with:
        egress-policy: audit
 
    - id: checkout
      uses: actions/checkout@v7
 
    - id: source-date-epoch
      run: |
        # source-date-epoch
        SOURCE_DATE_EPOCH=$(git log -1 --pretty=%at)
        echo SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH >> $GITHUB_ENV
        echo $(git log -1 --pretty=%ai) [timestamp=$SOURCE_DATE_EPOCH]
      shell: bash
 
    - id: setup-latex
      run: |
        # setup-latex
        sudo apt update && \
        sudo apt install -y \
           texlive-latex-base \
           texlive-latex-recommended \
           texlive-latex-extra \
           latexmk \
           texinfo
 
    - id: setup-python
      uses: actions/setup-python@v6
      with:
        cache: 'pip'
        python-version: 3
        pip-install: tox
 
    - id: build
      run: python -m tox run -m docs
 
    - id: archive
      run:  |
        archive=mpi4py-docs.zip
        rootdir=${archive%.zip}
        ln -s docs $rootdir
        python conf/metadata.py version > $rootdir/version
        python -m zipfile -c $archive $rootdir
 
    - id: upload
      uses: actions/upload-artifact@v7
      with:
        name: docs
        path: mpi4py-docs.zip
 
    - id: report
      run: |
        artifact='Artifact: <${{ steps.upload.outputs.artifact-url }}>'
 

What changed

1 third-party action is referenced by a movable tag. Pin it 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:

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