Skip to content
Latchkey

coverage workflow (vouch/vouch-proxy)

The coverage workflow from vouch/vouch-proxy, 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: vouch/vouch-proxy.github/workflows/coverage.ymlLicense MITView source

What it does

This is the coverage workflow from the vouch/vouch-proxy 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: coverage

on:
  workflow_dispatch:
  push:
  pull_request:

jobs:
  coverage:
    env:
      GOPATH: ${{ github.workspace }}
      VOUCH_ROOT: ${{ github.workspace }}/src/github.com/${{ github.repository }}
    defaults:
      run:
        working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        # go: ['1.14', '1.15']
        go: ['1.26']

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}
      - name: checkout 
        uses: actions/checkout@v2
        with:
          path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
      - name: goget
        run: ./do.sh goget
      - name: coverage test
        run: ./do.sh coverage

      - name: Send coverage
        uses: shogo82148/actions-goveralls@v1
        with:
          path-to-profile: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/.cover/cover.out
          flag-name: Go-${{ matrix.go }}
          parallel: true

  # notifies that all test jobs are finished.
  finish:
    needs: coverage
    runs-on: ubuntu-latest
    steps:
      - uses: shogo82148/actions-goveralls@v1
        with:
          parallel-finished: true

The same workflow, on Latchkey

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

name: coverage
 
on:
  workflow_dispatch:
  push:
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  coverage:
    timeout-minutes: 30
    env:
      GOPATH: ${{ github.workspace }}
      VOUCH_ROOT: ${{ github.workspace }}/src/github.com/${{ github.repository }}
    defaults:
      run:
        working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        # go: ['1.14', '1.15']
        go: ['1.26']
 
    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}
      - name: checkout 
        uses: actions/checkout@v2
        with:
          path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
      - name: goget
        run: ./do.sh goget
      - name: coverage test
        run: ./do.sh coverage
 
      - name: Send coverage
        uses: shogo82148/actions-goveralls@v1
        with:
          path-to-profile: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/.cover/cover.out
          flag-name: Go-${{ matrix.go }}
          parallel: true
 
  # notifies that all test jobs are finished.
  finish:
    timeout-minutes: 30
    needs: coverage
    runs-on: latchkey-small
    steps:
      - uses: shogo82148/actions-goveralls@v1
        with:
          parallel-finished: true

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

Actions used in this workflow