Go workflow (google/differential-privacy)
The Go workflow from google/differential-privacy, explained and optimized by Latchkey.
A
CI health: A - excellent
Point runs-on at Latchkey and get run de-duplication, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Go workflow from the google/differential-privacy 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
workflow (.yml)
name: Go
on:
push:
branches-ignore:
# Version 1.0 does not work with the "go" tool properly.
- "1.0"
pull_request:
branches-ignore:
# Version 1.0 does not work with the "go" tool properly.
- "1.0"
workflow_dispatch:
jobs:
go-tests:
name: Go Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.25
- name: Build go
run: go build -mod=mod -v ./...
working-directory: ./go
- name: Test go
run: go test -mod=mod -v ./...
working-directory: ./go
- name: Build examples/go
run: go build -mod=mod -v ./...
working-directory: ./examples/go
- name: Build privacy-on-beam
run: go build -mod=mod -v ./...
working-directory: ./privacy-on-beam
- name: Test privacy-on-beam
run: go test -mod=mod -v ./...
working-directory: ./privacy-on-beam
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Go on: push: branches-ignore: # Version 1.0 does not work with the "go" tool properly. - "1.0" pull_request: branches-ignore: # Version 1.0 does not work with the "go" tool properly. - "1.0" workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: go-tests: name: Go Tests runs-on: latchkey-small timeout-minutes: 15 steps: - uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6 with: go-version: 1.25 - name: Build go run: go build -mod=mod -v ./... working-directory: ./go - name: Test go run: go test -mod=mod -v ./... working-directory: ./go - name: Build examples/go run: go build -mod=mod -v ./... working-directory: ./examples/go - name: Build privacy-on-beam run: go build -mod=mod -v ./... working-directory: ./privacy-on-beam - name: Test privacy-on-beam run: go test -mod=mod -v ./... working-directory: ./privacy-on-beam
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.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.