Skip to content
Latchkey

Run tests workflow (urfave/cli)

The Run tests workflow from urfave/cli, explained and optimized by Latchkey.

C

CI health: C - fair

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: urfave/cli.github/workflows/test.ymlLicense MITView source

What it does

This is the Run tests workflow from the urfave/cli 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: Run tests

on:
  push:
    branches:
      - main
    tags:
      - v3.*
  pull_request:
    branches:
      - main

permissions:
  contents: read

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-24.04, macos-15, windows-2025]
        go: [stable, oldstable]

    name: ${{ matrix.os }} @ Go ${{ matrix.go }}
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v7

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go }}

      - name: Set PATH
        run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"

      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make ensure-goimports

      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make lint

      - run: make vet
      - run: make test
      - run: make check-binary-size

      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make generate

      - run: make diffcheck

      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make v3diff

      - if: success() && matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        uses: codecov/codecov-action@v7
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
          verbose: true

The same workflow, on Latchkey

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

name: Run tests
 
on:
  push:
    branches:
      - main
    tags:
      - v3.*
  pull_request:
    branches:
      - main
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    strategy:
      matrix:
        os: [ubuntu-24.04, macos-15, windows-2025]
        go: [stable, oldstable]
 
    name: ${{ matrix.os }} @ Go ${{ matrix.go }}
    runs-on: ${{ matrix.os }}
 
    steps:
      - uses: actions/checkout@v7
 
      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go }}
 
      - name: Set PATH
        run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"
 
      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make ensure-goimports
 
      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make lint
 
      - run: make vet
      - run: make test
      - run: make check-binary-size
 
      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make generate
 
      - run: make diffcheck
 
      - if: matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        run: make v3diff
 
      - if: success() && matrix.go == 'stable' && matrix.os == 'ubuntu-24.04'
        uses: codecov/codecov-action@v7
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
          verbose: true
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 1 job (6 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