Skip to content
Latchkey

Test workflow (mcuadros/ofelia)

The Test workflow from mcuadros/ofelia, 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: mcuadros/ofelia.github/workflows/test.ymlLicense MITView source

What it does

This is the Test workflow from the mcuadros/ofelia 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: Test
on:
  push:
    branches:
      - master
      - 0.3.x
      - 'renovate/**'
  pull_request:
    branches:
      - master
      - 0.3.x
jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        go-version: ['stable']
        platform: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
    runs-on: ${{ matrix.platform }}
    steps:

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

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

    - name: Install gotestsum
      run: go install gotest.tools/gotestsum@latest

    - name: Test
      run: gotestsum --format=github-actions --packages $(go list ./... | grep -v integration)


  integration_test:
    strategy:
      fail-fast: false
      matrix:
        go-version: ['stable']
        platform: [ubuntu-latest, ubuntu-24.04-arm]
    runs-on: ${{ matrix.platform }}
    steps:

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

    - name: Install gotestsum
      run: go install gotest.tools/gotestsum@latest

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

    - name: Integration tests
      working-directory: integration
      run: gotestsum --rerun-fails=3 --format=github-actions

The same workflow, on Latchkey

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

name: Test
on:
  push:
    branches:
      - master
      - 0.3.x
      - 'renovate/**'
  pull_request:
    branches:
      - master
      - 0.3.x
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        go-version: ['stable']
        platform: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
    runs-on: ${{ matrix.platform }}
    steps:
 
    - name: Install Go
      uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.go-version }}
 
    - name: Checkout code
      uses: actions/checkout@v4
 
    - name: Install gotestsum
      run: go install gotest.tools/gotestsum@latest
 
    - name: Test
      run: gotestsum --format=github-actions --packages $(go list ./... | grep -v integration)
 
 
  integration_test:
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        go-version: ['stable']
        platform: [ubuntu-latest, ubuntu-24.04-arm]
    runs-on: ${{ matrix.platform }}
    steps:
 
    - name: Install Go
      uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.go-version }}
 
    - name: Install gotestsum
      run: go install gotest.tools/gotestsum@latest
 
    - name: Checkout code
      uses: actions/checkout@v4
 
    - name: Integration tests
      working-directory: integration
      run: gotestsum --rerun-fails=3 --format=github-actions
 

What changed

This workflow runs 2 jobs (5 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