Skip to content
Latchkey

Continuous Integration - Documentation workflow (colour-science/colour)

The Continuous Integration - Documentation workflow from colour-science/colour, explained and optimized by Latchkey.

D

CI health: D - needs work

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: colour-science/colour.github/workflows/continuous-integration-documentation.ymlLicense BSD-3-ClauseView source

What it does

This is the Continuous Integration - Documentation workflow from the colour-science/colour 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: Continuous Integration - Documentation

on: [push, pull_request]

jobs:
  continuous-integration-documentation:
    name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.13]
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Environment Variables
        run: |
          echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
          echo "CI_PACKAGE=colour" >> $GITHUB_ENV
          echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
          echo "MPLBACKEND=AGG" >> $GITHUB_ENV
          echo "COLOUR_SCIENCE__DOCUMENTATION_BUILD=True" >> $GITHUB_ENV
        shell: bash
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Clean Up Disk Space
        run: |
          df -h /

          sudo rm -rf /usr/lib/jvm
          sudo rm -rf /usr/local/.ghcup
          sudo rm -rf /usr/local/lib/android
          sudo rm -rf /usr/local/share/powershell
          sudo rm -rf /usr/share/dotnet
          sudo rm -rf /usr/share/swift
          sudo rm -rf "$AGENT_TOOLSDIRECTORY"

          df -h /
      - name: Install Dependencies
        run: |
          sudo apt-get update
          sudo apt-get --yes install graphviz graphviz-dev latexmk texlive-full
      - name: Install uv
        run: |
          pip install uv
        shell: bash
      - name: Install Package Dependencies
        run: |
          uv sync --all-extras --no-dev
          uv run python -c "import imageio;imageio.plugins.freeimage.download()"
        shell: bash
      - name: Build Documentation
        run: |
          uv run invoke docs
        shell: bash
      - uses: actions/upload-artifact@v4
        with:
          name: ${{ env.CI_PACKAGE }}-plots
          path: |
            docs/_static/Basics_*.png
            docs/_static/Examples_*.png
            docs/_static/Plotting_*.png
            docs/_static/Tutorial_*.png

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: Continuous Integration - Documentation
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  continuous-integration-documentation:
    timeout-minutes: 30
    name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.13]
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Environment Variables
        run: |
          echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
          echo "CI_PACKAGE=colour" >> $GITHUB_ENV
          echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
          echo "MPLBACKEND=AGG" >> $GITHUB_ENV
          echo "COLOUR_SCIENCE__DOCUMENTATION_BUILD=True" >> $GITHUB_ENV
        shell: bash
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: ${{ matrix.python-version }}
      - name: Clean Up Disk Space
        run: |
          df -h /
 
          sudo rm -rf /usr/lib/jvm
          sudo rm -rf /usr/local/.ghcup
          sudo rm -rf /usr/local/lib/android
          sudo rm -rf /usr/local/share/powershell
          sudo rm -rf /usr/share/dotnet
          sudo rm -rf /usr/share/swift
          sudo rm -rf "$AGENT_TOOLSDIRECTORY"
 
          df -h /
      - name: Install Dependencies
        run: |
          sudo apt-get update
          sudo apt-get --yes install graphviz graphviz-dev latexmk texlive-full
      - name: Install uv
        run: |
          pip install uv
        shell: bash
      - name: Install Package Dependencies
        run: |
          uv sync --all-extras --no-dev
          uv run python -c "import imageio;imageio.plugins.freeimage.download()"
        shell: bash
      - name: Build Documentation
        run: |
          uv run invoke docs
        shell: bash
      - uses: actions/upload-artifact@v4
        with:
          name: ${{ env.CI_PACKAGE }}-plots
          path: |
            docs/_static/Basics_*.png
            docs/_static/Examples_*.png
            docs/_static/Plotting_*.png
            docs/_static/Tutorial_*.png
 

What changed

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