CI workflow (databus23/helm-diff)
The CI workflow from databus23/helm-diff, explained and optimized by Latchkey.
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.
What it does
This is the CI workflow from the databus23/helm-diff 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
---
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
build:
name: "Build & Test"
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: "go.mod"
- name: Run unit tests
run: make test
- name: Verify installation
run: |
mkdir -p helmhome
make install HELM_HOME=helmhome
helmhome/plugins/helm-diff/bin/diff version
helm-install:
name: helm install
if: "!contains(github.event.head_commit.message, '[ci skip]')"
needs: [build]
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
shell: [default]
experimental: [false]
helm-version: [v3.18.6, v3.21.1, v4.2.1]
include:
- os: windows-latest
shell: wsl
experimental: false
helm-version: v3.18.6
- os: windows-latest
shell: cygwin
experimental: false
helm-version: v3.18.6
- os: ubuntu-latest
container: alpine
shell: sh
experimental: false
helm-version: v3.18.6
- os: windows-latest
shell: wsl
experimental: false
helm-version: v3.21.1
- os: windows-latest
shell: cygwin
experimental: false
helm-version: v3.21.1
- os: ubuntu-latest
container: alpine
shell: sh
experimental: false
helm-version: v3.21.1
- os: windows-latest
shell: wsl
experimental: false
helm-version: v4.2.1
- os: windows-latest
shell: cygwin
experimental: false
helm-version: v4.2.1
- os: ubuntu-latest
container: alpine
shell: sh
experimental: false
helm-version: v4.2.1
steps:
- name: Disable autocrlf
if: "contains(matrix.os, 'windows-latest')"
run: |-
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v7
- name: Setup Helm
uses: azure/setup-helm@v5
with:
version: "${{ matrix.helm-version }}"
- name: Setup WSL
if: "contains(matrix.shell, 'wsl')"
uses: Vampire/setup-wsl@v7
- name: Setup Cygwin
if: "contains(matrix.shell, 'cygwin')"
uses: egor-tensin/setup-cygwin@v4
- name: helm plugin install
run: helm plugin install --debug .
integration-tests:
name: Integration Tests
if: "!contains(github.event.head_commit.message, '[ci skip]')"
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Helm maintains the latest minor version only and therefore each Helmfile version supports 2 Helm minor versions.
# That's why we cover only 2 Helm minor versions in this matrix.
# See https://github.com/helmfile/helmfile/pull/286#issuecomment-1250161182 for more context.
- helm-version: v3.18.6
- helm-version: v3.21.1
- helm-version: v4.2.1
steps:
- uses: helm/kind-action@v1.14.0
with:
cluster_name: kind
- uses: actions/checkout@v7
- name: Setup Helm
uses: azure/setup-helm@v5
with:
version: ${{ matrix.helm-version }}
- name: Helm Version
run: helm version
- name: helm plugin install
run: make install/helm
- name: helm create helm-diff
run: helm create helm-diff
- name: helm diff upgrade --install helm-diff ./helm-diff
run: helm diff upgrade --install helm-diff ./helm-diff
- name: helm upgrade -i helm-diff ./helm-diff
run: helm upgrade -i helm-diff ./helm-diff
- name: helm diff upgrade -C 3 --set replicaCount=2 --install helm-diff ./helm-diff
run: helm diff upgrade -C 3 --set replicaCount=2 --install helm-diff ./helm-diff
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
--- name: CI on: pull_request: push: branches: - master concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 name: "Build & Test" if: "!contains(github.event.head_commit.message, '[ci skip]')" runs-on: latchkey-small steps: - uses: actions/checkout@v7 - uses: actions/setup-go@v6 with: go-version-file: "go.mod" - name: Run unit tests run: make test - name: Verify installation run: | mkdir -p helmhome make install HELM_HOME=helmhome helmhome/plugins/helm-diff/bin/diff version helm-install: timeout-minutes: 30 name: helm install if: "!contains(github.event.head_commit.message, '[ci skip]')" needs: [build] runs-on: ${{ matrix.os }} container: ${{ matrix.container }} continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] shell: [default] experimental: [false] helm-version: [v3.18.6, v3.21.1, v4.2.1] include: - os: windows-latest shell: wsl experimental: false helm-version: v3.18.6 - os: windows-latest shell: cygwin experimental: false helm-version: v3.18.6 - os: ubuntu-latest container: alpine shell: sh experimental: false helm-version: v3.18.6 - os: windows-latest shell: wsl experimental: false helm-version: v3.21.1 - os: windows-latest shell: cygwin experimental: false helm-version: v3.21.1 - os: ubuntu-latest container: alpine shell: sh experimental: false helm-version: v3.21.1 - os: windows-latest shell: wsl experimental: false helm-version: v4.2.1 - os: windows-latest shell: cygwin experimental: false helm-version: v4.2.1 - os: ubuntu-latest container: alpine shell: sh experimental: false helm-version: v4.2.1 steps: - name: Disable autocrlf if: "contains(matrix.os, 'windows-latest')" run: |- git config --global core.autocrlf false git config --global core.eol lf - uses: actions/checkout@v7 - name: Setup Helm uses: azure/setup-helm@v5 with: version: "${{ matrix.helm-version }}" - name: Setup WSL if: "contains(matrix.shell, 'wsl')" uses: Vampire/setup-wsl@v7 - name: Setup Cygwin if: "contains(matrix.shell, 'cygwin')" uses: egor-tensin/setup-cygwin@v4 - name: helm plugin install run: helm plugin install --debug . integration-tests: timeout-minutes: 30 name: Integration Tests if: "!contains(github.event.head_commit.message, '[ci skip]')" needs: [build] runs-on: latchkey-small strategy: matrix: include: # Helm maintains the latest minor version only and therefore each Helmfile version supports 2 Helm minor versions. # That's why we cover only 2 Helm minor versions in this matrix. # See https://github.com/helmfile/helmfile/pull/286#issuecomment-1250161182 for more context. - helm-version: v3.18.6 - helm-version: v3.21.1 - helm-version: v4.2.1 steps: - uses: helm/kind-action@v1.14.0 with: cluster_name: kind - uses: actions/checkout@v7 - name: Setup Helm uses: azure/setup-helm@v5 with: version: ${{ matrix.helm-version }} - name: Helm Version run: helm version - name: helm plugin install run: make install/helm - name: helm create helm-diff run: helm create helm-diff - name: helm diff upgrade --install helm-diff ./helm-diff run: helm diff upgrade --install helm-diff ./helm-diff - name: helm upgrade -i helm-diff ./helm-diff run: helm upgrade -i helm-diff ./helm-diff - name: helm diff upgrade -C 3 --set replicaCount=2 --install helm-diff ./helm-diff run: helm diff upgrade -C 3 --set replicaCount=2 --install helm-diff ./helm-diff
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
4 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 3 jobs (11 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.