Skip to content
Latchkey

CI workflow (jedib0t/go-pretty)

The CI workflow from jedib0t/go-pretty, 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: jedib0t/go-pretty.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the jedib0t/go-pretty 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: CI

on:
  # Pushes and pulls to all branches
  push:
  pull_request:

  # Run on the first day of every month
  schedule:
    - cron: "0 0 1 * *"

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  # Build and test everything
  build:
    runs-on: ubuntu-latest
    steps:
      # Checkout the code
      - name: Checkout Code
        uses: actions/checkout@v4

      # Set up the GoLang environment
      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: 1.18

      # Download all the tools used in the steps that follow
      - name: Set up Tools
        run: |
          make tools-ci

      # Run golangci-lint
      - name: Run golangci-lint
        uses: golangci/golangci-lint-action@v9
        with:
          version: v2.7.2
          args: --timeout=5m

      # Run all the unit-tests
      - name: Test (no lint)
        run: |
          make test-no-lint

      # Run some tests to ensure no race conditions exist
      - name: Test for Race Conditions
        run: make test-race

      # Run the benchmarks to manually ensure no performance degradation
      - name: Benchmark
        run: make bench

      # Upload all the unit-test coverage reports to Coveralls
      - name: Upload Coverage Report
        env:
          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: goveralls -service=github -coverprofile=.coverprofile

The same workflow, on Latchkey

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

name: CI
 
on:
  # Pushes and pulls to all branches
  push:
  pull_request:
 
  # Run on the first day of every month
  schedule:
    - cron: "0 0 1 * *"
 
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  # Build and test everything
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      # Checkout the code
      - name: Checkout Code
        uses: actions/checkout@v4
 
      # Set up the GoLang environment
      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: 1.18
 
      # Download all the tools used in the steps that follow
      - name: Set up Tools
        run: |
          make tools-ci
 
      # Run golangci-lint
      - name: Run golangci-lint
        uses: golangci/golangci-lint-action@v9
        with:
          version: v2.7.2
          args: --timeout=5m
 
      # Run all the unit-tests
      - name: Test (no lint)
        run: |
          make test-no-lint
 
      # Run some tests to ensure no race conditions exist
      - name: Test for Race Conditions
        run: make test-race
 
      # Run the benchmarks to manually ensure no performance degradation
      - name: Benchmark
        run: make bench
 
      # Upload all the unit-test coverage reports to Coveralls
      - name: Upload Coverage Report
        env:
          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: goveralls -service=github -coverprofile=.coverprofile
 
 

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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow