Skip to content
Latchkey

Build Python package workflow (Spenhouet/confluence-markdown-exporter)

The Build Python package workflow from Spenhouet/confluence-markdown-exporter, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, 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: Spenhouet/confluence-markdown-exporter.github/workflows/python-build.ymlLicense MITView source

What it does

This is the Build Python package workflow from the Spenhouet/confluence-markdown-exporter 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 Python package

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    name: Test, lint and build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true

      - name: Install dependencies
        run: uv sync --locked --all-groups

      - name: Run linting with ruff
        run: uv run ruff check

      - name: Run tests with pytest
        run: uv run pytest

      - name: Test build (with sources for development)
        run: uv build

      - name: Test build (without sources for publication)
        run: |
          rm -rf dist/
          uv build --no-sources

      - name: Test package installation and import
        run: |
          uv run --with dist/*.whl --no-project -- python -c "import confluence_markdown_exporter; print('Package imports successfully')"

      - name: Test CLI commands
        run: |
          uv run --with dist/*.whl --no-project confluence-markdown-exporter --help
          uv run --with dist/*.whl --no-project cme --help

      - name: Upload build artifacts for inspection
        uses: actions/upload-artifact@v7
        with:
          name: build-artifacts
          path: dist/
          retention-days: 5

The same workflow, on Latchkey

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

name: Build Python package
 
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    name: Test, lint and build
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v7
 
      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
 
      - name: Install dependencies
        run: uv sync --locked --all-groups
 
      - name: Run linting with ruff
        run: uv run ruff check
 
      - name: Run tests with pytest
        run: uv run pytest
 
      - name: Test build (with sources for development)
        run: uv build
 
      - name: Test build (without sources for publication)
        run: |
          rm -rf dist/
          uv build --no-sources
 
      - name: Test package installation and import
        run: |
          uv run --with dist/*.whl --no-project -- python -c "import confluence_markdown_exporter; print('Package imports successfully')"
 
      - name: Test CLI commands
        run: |
          uv run --with dist/*.whl --no-project confluence-markdown-exporter --help
          uv run --with dist/*.whl --no-project cme --help
 
      - name: Upload build artifacts for inspection
        uses: actions/upload-artifact@v7
        with:
          name: build-artifacts
          path: dist/
          retention-days: 5
 

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.

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