Build Package From Source workflow (expectedparrot/edsl)
The Build Package From Source workflow from expectedparrot/edsl, explained and optimized by Latchkey.
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 →What it does
This is the Build Package From Source workflow from the expectedparrot/edsl 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
name: Build Package From Source
# Build package from source (without pip install)
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
POETRY_VERSION: "1.7.1"
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check commit count
shell: bash
id: check_commit_count
run: |
commit_count=$(git log --oneline | wc -l)
echo "Commit count: $commit_count"
if [ $(($commit_count % 1)) -eq 0 ]; then
echo "run_build_test=true" >> $GITHUB_ENV
fi
- if: env.run_build_test == 'true'
name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- if: env.run_build_test == 'true'
name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- if: env.run_build_test == 'true'
name: Install deps
shell: bash
run: poetry install --without dev,test
- if: env.run_build_test == 'true'
name: Build
shell: bash
run: poetry build
- if: env.run_build_test == 'true'
name: Test installing built package
shell: bash
run: python -m pip install .
- if: env.run_build_test == 'true'
name: Test import
shell: bash
working-directory: ${{ vars.RUNNER_TEMP }}
run: python -c "import edsl"
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: Build Package From Source # Build package from source (without pip install) on: push: branches: - main pull_request: branches: - main workflow_dispatch: env: POETRY_VERSION: "1.7.1" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Check commit count shell: bash id: check_commit_count run: | commit_count=$(git log --oneline | wc -l) echo "Commit count: $commit_count" if [ $(($commit_count % 1)) -eq 0 ]; then echo "run_build_test=true" >> $GITHUB_ENV fi - if: env.run_build_test == 'true' name: Set up python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: cache: 'pip' python-version: ${{ matrix.python-version }} - if: env.run_build_test == 'true' name: Install Poetry uses: snok/install-poetry@v1 with: version: ${{ env.POETRY_VERSION }} - if: env.run_build_test == 'true' name: Install deps shell: bash run: poetry install --without dev,test - if: env.run_build_test == 'true' name: Build shell: bash run: poetry build - if: env.run_build_test == 'true' name: Test installing built package shell: bash run: python -m pip install . - if: env.run_build_test == 'true' name: Test import shell: bash working-directory: ${{ vars.RUNNER_TEMP }} run: python -c "import edsl"
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Cache dependency installs on the setup step so they are served from cache.
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:
- Dependency installs
This workflow runs 1 job (12 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.