Skip to content
Latchkey

Build workflow (nicksnyder/go-i18n)

The Build workflow from nicksnyder/go-i18n, explained and optimized by Latchkey.

C

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.

Grade your own workflow free or run it on Latchkey →
Source: nicksnyder/go-i18n.github/workflows/build.ymlLicense MITView source

What it does

This is the Build workflow from the nicksnyder/go-i18n 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: Build
on:
  push:
    branches:
      - main
  pull_request:

jobs:
  build:
    name: Build (go:${{ matrix.go-version.name }})
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go-version:
        - name: latest
          version: 1.25.x
        - name: previous
          version: 1.24.x
    steps:
      - name: Install Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go-version.version }}
      - name: Git checkout
        uses: actions/checkout@v6
      - name: Build
        uses: goreleaser/goreleaser-action@v6
        with:
          version: latest
          args: release --clean --snapshot
      - name: Test
        run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
      - name: Upload coverage
        uses: codecov/codecov-action@v5
        if: matrix.go-version.name == 'latest'
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
      - name: Lint
        uses: golangci/golangci-lint-action@v9
        if: matrix.go-version.name == 'latest'
        with:
          version: v2.6

The same workflow, on Latchkey

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

name: Build
on:
  push:
    branches:
      - main
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    name: Build (go:${{ matrix.go-version.name }})
    runs-on: latchkey-small
    strategy:
      matrix:
        go-version:
        - name: latest
          version: 1.25.x
        - name: previous
          version: 1.24.x
    steps:
      - name: Install Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go-version.version }}
      - name: Git checkout
        uses: actions/checkout@v6
      - name: Build
        uses: goreleaser/goreleaser-action@v6
        with:
          version: latest
          args: release --clean --snapshot
      - name: Test
        run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
      - name: Upload coverage
        uses: codecov/codecov-action@v5
        if: matrix.go-version.name == 'latest'
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
      - name: Lint
        uses: golangci/golangci-lint-action@v9
        if: matrix.go-version.name == 'latest'
        with:
          version: v2.6
 

What changed

3 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 1 job (2 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