Skip to content
Latchkey

CI workflow (mbarkhau/bumpver)

The CI workflow from mbarkhau/bumpver, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get 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: mbarkhau/bumpver.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the mbarkhau/bumpver 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: CI

on: [push, pull_request]

jobs:

  build-ubuntu:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: config
      run:
        git config --global init.defaultBranch master

    - name: Cache Conda Envs
      uses: actions/cache@v4
      with:
        path: |
          ~/miniconda3
          build/*.txt
        key: ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}
        restore-keys: |
          ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}

    - name: make conda
      run:
        if [[ -e build/envs.txt ]]; then touch build/envs.txt; fi;
        if [[ -e build/deps.txt ]]; then touch build/deps.txt; fi;
        make conda

    - name: make mypy
      run: make mypy

    - name: make test
      run: make test

    - name: make test_compat
      run: make test_compat

  build-macos:

    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v4

    - name: config
      run:
        git config --global init.defaultBranch master

    - name: Cache Conda Envs
      uses: actions/cache@v4
      with:
        path: |
          ~/miniconda3
          build/*.txt
        key: ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}
        restore-keys: |
          ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}

    - name: brew install mercurial
      run: brew install mercurial

    - name: make conda
      run:
        if [[ -e build/envs.txt ]]; then touch build/envs.txt; fi;
        if [[ -e build/deps.txt ]]; then touch build/deps.txt; fi;
        make conda

    - name: make mypy
      run: make mypy

    - name: make test
      run: make test

The same workflow, on Latchkey

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

name: CI
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
 
  build-ubuntu:
    timeout-minutes: 30
 
    runs-on: latchkey-small
 
    steps:
    - uses: actions/checkout@v4
 
    - name: config
      run:
        git config --global init.defaultBranch master
 
    - name: Cache Conda Envs
      uses: actions/cache@v4
      with:
        path: |
          ~/miniconda3
          build/*.txt
        key: ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}
        restore-keys: |
          ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}
 
    - name: make conda
      run:
        if [[ -e build/envs.txt ]]; then touch build/envs.txt; fi;
        if [[ -e build/deps.txt ]]; then touch build/deps.txt; fi;
        make conda
 
    - name: make mypy
      run: make mypy
 
    - name: make test
      run: make test
 
    - name: make test_compat
      run: make test_compat
 
  build-macos:
    timeout-minutes: 30
 
    runs-on: macos-latest
 
    steps:
    - uses: actions/checkout@v4
 
    - name: config
      run:
        git config --global init.defaultBranch master
 
    - name: Cache Conda Envs
      uses: actions/cache@v4
      with:
        path: |
          ~/miniconda3
          build/*.txt
        key: ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}
        restore-keys: |
          ${{ runner.OS }}-conda-cache-${{ hashFiles('requirements/*.txt', 'setup.py', 'Makefile*') }}
 
    - name: brew install mercurial
      run: brew install mercurial
 
    - name: make conda
      run:
        if [[ -e build/envs.txt ]]; then touch build/envs.txt; fi;
        if [[ -e build/deps.txt ]]; then touch build/deps.txt; fi;
        make conda
 
    - name: make mypy
      run: make mypy
 
    - name: make test
      run: make test
 

What changed

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow