Skip to content
Latchkey

All builds workflow (stretchr/testify)

The All builds workflow from stretchr/testify, 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: stretchr/testify.github/workflows/main.ymlLicense MITView source

What it does

This is the All builds workflow from the stretchr/testify 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: All builds
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go_version:
          - stable
          - oldstable
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - name: Setup Go
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: ${{ matrix.go_version }}
      - run: ./.ci.gogenerate.sh
      - run: ./.ci.gofmt.sh
      - run: ./.ci.govet.sh
      - run: go test -v -race ./...

  test-old-go:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go_version:
          - "1.17"
          - "1.18"
          - "1.19"
          - "1.20"
          - "1.21"
          - "1.22"
          - "1.23"
          - "1.24"
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - name: Setup Go
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: ${{ matrix.go_version }}
      - run: go test -v -race ./...

  check-actions-hashes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - run: ./.ci.ghactions.sh

The same workflow, on Latchkey

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

name: All builds
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      matrix:
        go_version:
          - stable
          - oldstable
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - name: Setup Go
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: ${{ matrix.go_version }}
      - run: ./.ci.gogenerate.sh
      - run: ./.ci.gofmt.sh
      - run: ./.ci.govet.sh
      - run: go test -v -race ./...
 
  test-old-go:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      matrix:
        go_version:
          - "1.17"
          - "1.18"
          - "1.19"
          - "1.20"
          - "1.21"
          - "1.22"
          - "1.23"
          - "1.24"
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - name: Setup Go
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: ${{ matrix.go_version }}
      - run: go test -v -race ./...
 
  check-actions-hashes:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - run: ./.ci.ghactions.sh
 

What changed

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.

Actions used in this workflow