Build ncem Package workflow (theislab/ncem)
The Build ncem Package workflow from theislab/ncem, 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 ncem Package workflow from the theislab/ncem 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
name: Build ncem Package
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python: [3.8]
steps:
- uses: actions/checkout@v2
name: Check out source-code repository
- name: Setup Python
uses: actions/setup-python@v4.3.0
with:
python-version: ${{ matrix.python }}
- name: Install Poetry
run: |
pip install poetry
poetry --version
- name: Build package
run: poetry build --ansi
- name: Install required twine packaging dependencies
run: pip install setuptools wheel twine
- name: Check twine package
run: twine check dist/*
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 ncem Package on: [push, pull_request] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')" strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] python: [3.8] steps: - uses: actions/checkout@v2 name: Check out source-code repository - name: Setup Python uses: actions/setup-python@v4.3.0 with: cache: 'pip' python-version: ${{ matrix.python }} - name: Install Poetry run: | pip install poetry poetry --version - name: Build package run: poetry build --ansi - name: Install required twine packaging dependencies run: pip install setuptools wheel twine - name: Check twine package run: twine check dist/*
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.
- Add a job timeout so a hung step cannot burn hours of runner time.
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 (3 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.