Skip to content
Latchkey

Unit & Integration tests workflow (olric-data/olric)

The Unit & Integration tests workflow from olric-data/olric, 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: olric-data/olric.github/workflows/ci.ymlLicense Apache-2.0View source

What it does

This is the Unit & Integration tests workflow from the olric-data/olric 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: Unit & Integration tests

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  test:
    strategy:
      # Default is true, cancels jobs for other platforms in the matrix if one fails
      fail-fast: false
      matrix:
        os: [ ubuntu-latest ]
        go: [ '1.25', '1.26' ]

    runs-on: ${{ matrix.os }}

    steps:
    - name: Install Go
      uses: actions/setup-go@v4
      with:
        go-version: ${{ matrix.go }}

    - name: Checkout code
      uses: actions/checkout@v3

    - name: Print Go version and environment
      id: vars
      run: |
        printf "Using go at: $(which go)\n"
        printf "Go version: $(go version)\n"
        printf "\n\nGo environment:\n\n"
        go env
        printf "\n\nSystem environment:\n\n"
        env
        # Calculate the short SHA1 hash of the git commit
        echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
        echo "::set-output name=go_cache::$(go env GOCACHE)"

    - name: Cache the build cache
      uses: actions/cache@v4
      with:
        path: ${{ steps.vars.outputs.go_cache }}
        key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.go }}-go-ci

    - name: Install dependencies
      run: |
        go mod download

    - name: Run tests
      run: make test

The same workflow, on Latchkey

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

name: Unit & Integration tests
 
on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    strategy:
      # Default is true, cancels jobs for other platforms in the matrix if one fails
      fail-fast: false
      matrix:
        os: [ ubuntu-latest ]
        go: [ '1.25', '1.26' ]
 
    runs-on: ${{ matrix.os }}
 
    steps:
    - name: Install Go
      uses: actions/setup-go@v4
      with:
        go-version: ${{ matrix.go }}
 
    - name: Checkout code
      uses: actions/checkout@v3
 
    - name: Print Go version and environment
      id: vars
      run: |
        printf "Using go at: $(which go)\n"
        printf "Go version: $(go version)\n"
        printf "\n\nGo environment:\n\n"
        go env
        printf "\n\nSystem environment:\n\n"
        env
        # Calculate the short SHA1 hash of the git commit
        echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
        echo "::set-output name=go_cache::$(go env GOCACHE)"
 
    - name: Cache the build cache
      uses: actions/cache@v4
      with:
        path: ${{ steps.vars.outputs.go_cache }}
        key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.go }}-go-ci
 
    - name: Install dependencies
      run: |
        go mod download
 
    - name: Run tests
      run: make test
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

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