Skip to content
Latchkey

Build and run workflow (erikbern/git-of-theseus)

The Build and run workflow from erikbern/git-of-theseus, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: erikbern/git-of-theseus.github/workflows/ci-cd.ymlLicense Apache-2.0View source

What it does

This is the Build and run workflow from the erikbern/git-of-theseus repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Build and run

on: [push]

env:
  DISPLAY: ":99.0"

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
    name: Tests on Python ${{ matrix.python-version }}
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3

      - name: Install Python
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install package
        run: | 
          pip install .
          pip install scipy

      - name: Run tests
        run: |
          git clone https://github.com/erikbern/git-of-theseus
          git-of-theseus-analyze git-of-theseus --outdir got
          git-of-theseus-stack-plot got/cohorts.json
          git-of-theseus-stack-plot got/cohorts.json --normalize
          git-of-theseus-stack-plot got/exts.json
          git-of-theseus-stack-plot got/authors.json
          git-of-theseus-line-plot got/authors.json
          git-of-theseus-line-plot got/dirs.json
          git-of-theseus-survival-plot got/survival.json --exp-fit
          git-of-theseus-analyze --help
          git-of-theseus-stack-plot --help
          git-of-theseus-survival-plot --help

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 and run
 
on: [push]
 
env:
  DISPLAY: ":99.0"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      matrix:
        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
    name: Tests on Python ${{ matrix.python-version }}
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
 
      - name: Install Python
        uses: actions/setup-python@v4
        with:
          cache: 'pip'
          python-version: ${{ matrix.python-version }}
 
      - name: Install package
        run: | 
          pip install .
          pip install scipy
 
      - name: Run tests
        run: |
          git clone https://github.com/erikbern/git-of-theseus
          git-of-theseus-analyze git-of-theseus --outdir got
          git-of-theseus-stack-plot got/cohorts.json
          git-of-theseus-stack-plot got/cohorts.json --normalize
          git-of-theseus-stack-plot got/exts.json
          git-of-theseus-stack-plot got/authors.json
          git-of-theseus-line-plot got/authors.json
          git-of-theseus-line-plot got/dirs.json
          git-of-theseus-survival-plot got/survival.json --exp-fit
          git-of-theseus-analyze --help
          git-of-theseus-stack-plot --help
          git-of-theseus-survival-plot --help
 

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 (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow