Run checks workflow (labstack/echo)
The Run checks workflow from labstack/echo, 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.
What it does
This is the Run checks workflow from the labstack/echo 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 checks
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
env:
LATEST_GO_VERSION: "1.26"
# https://github.com/actions/checkout/commit/df4cb1c069e1874edd31b4311f1884172cec0e10
CHECKOUT_ACTION: &checkout_action actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
# https://github.com/actions/setup-go/commit/924ae3a1cded613372ab5595356fb5720e22ba16
SETUP_GO_ACTION: &setup_go_action actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: *checkout_action
- name: Set up Go
uses: *setup_go_action
with:
go-version: ${{ env.LATEST_GO_VERSION }}
check-latest: true
- name: Run golint
run: |
go install golang.org/x/lint/golint@latest
golint -set_exit_status ./...
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run govulncheck
run: |
go version
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Run checks on: push: branches: - master pull_request: branches: - master workflow_dispatch: permissions: contents: read # to fetch code (actions/checkout) env: LATEST_GO_VERSION: "1.26" # https://github.com/actions/checkout/commit/df4cb1c069e1874edd31b4311f1884172cec0e10 CHECKOUT_ACTION: &checkout_action actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 # https://github.com/actions/setup-go/commit/924ae3a1cded613372ab5595356fb5720e22ba16 SETUP_GO_ACTION: &setup_go_action actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6 concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: check: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout Code uses: *checkout_action - name: Set up Go uses: *setup_go_action with: go-version: ${{ env.LATEST_GO_VERSION }} check-latest: true - name: Run golint run: | go install golang.org/x/lint/golint@latest golint -set_exit_status ./... - name: Run staticcheck run: | go install honnef.co/go/tools/cmd/staticcheck@latest staticcheck ./... - name: Run govulncheck run: | go version go install golang.org/x/vuln/cmd/govulncheck@latest govulncheck ./...
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.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.