Skip to content
Latchkey

Build Documentation workflow (torchmd/torchmd-net)

The Build Documentation workflow from torchmd/torchmd-net, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get 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: torchmd/torchmd-net.github/workflows/docs.ymlLicense MITView source

What it does

This is the Build Documentation workflow from the torchmd/torchmd-net 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

workflow (.yml)
name: Build Documentation

on:
  workflow_dispatch:
  workflow_call:

jobs:
  build-docs:
    runs-on: ubuntu-latest

    defaults: # Needed for conda
      run:
        shell: bash -l {0}

    steps:
      - uses: actions/checkout@v4

      - uses: conda-incubator/setup-miniconda@v3
        with:
          python-version: "3.10"
          channels: conda-forge
          conda-remove-defaults: "true"

      - name: Install compiler
        run: conda install gxx --channel conda-forge --override-channels

      - name: Install docs dependencies
        run: |
          pip install build
          python -m build
          pip install dist/*.whl
          pip install -r docs/requirements.txt
        env:
          ACCELERATOR: "cpu"

      - name: Build Sphinx Documentation
        run: |
          cd docs
          make html

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Build Documentation
 
on:
  workflow_dispatch:
  workflow_call:
 
jobs:
  build-docs:
    timeout-minutes: 30
    runs-on: latchkey-small
 
    defaults: # Needed for conda
      run:
        shell: bash -l {0}
 
    steps:
      - uses: actions/checkout@v4
 
      - uses: conda-incubator/setup-miniconda@v3
        with:
          python-version: "3.10"
          channels: conda-forge
          conda-remove-defaults: "true"
 
      - name: Install compiler
        run: conda install gxx --channel conda-forge --override-channels
 
      - name: Install docs dependencies
        run: |
          pip install build
          python -m build
          pip install dist/*.whl
          pip install -r docs/requirements.txt
        env:
          ACCELERATOR: "cpu"
 
      - name: Build Sphinx Documentation
        run: |
          cd docs
          make html
 

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