Codecov master baseline workflow (kiali/kiali)
The Codecov master baseline workflow from kiali/kiali, explained and optimized by Latchkey.
A
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Codecov master baseline workflow from the kiali/kiali 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)
# Refreshes Codecov's default-branch baseline on every push to master.
# Kiali CI only uploads merged coverage after long integration jobs; this workflow
# ensures master always has a recent report even when the main workflow is skipped
# (paths-ignore) or before the full codecov_merge_upload job was added.
name: Codecov master baseline
on:
push:
branches:
- master
paths-ignore:
- "design/**"
- "**/*.md"
- "**/*.adoc"
workflow_dispatch:
concurrency:
group: codecov-master-baseline-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
upload_unit_coverage:
name: Upload unit coverage to Codecov (master)
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
cache: true
cache-dependency-path: go.sum
go-version-file: go.mod
- name: Run unit tests with coverage
run: make -e GO_TEST_FLAGS="-race -coverpkg=github.com/kiali/kiali/... -coverprofile=coverage-unit.out" test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
disable_search: true
fail_ci_if_error: true
files: coverage-unit.out
flags: integration
override_branch: ${{ github.ref_name }}
override_commit: ${{ github.sha }}
slug: kiali/kiali
token: ${{ secrets.CODECOV_TOKEN }}
use_pypi: true
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Refreshes Codecov's default-branch baseline on every push to master. # Kiali CI only uploads merged coverage after long integration jobs; this workflow # ensures master always has a recent report even when the main workflow is skipped # (paths-ignore) or before the full codecov_merge_upload job was added. name: Codecov master baseline on: push: branches: - master paths-ignore: - "design/**" - "**/*.md" - "**/*.adoc" workflow_dispatch: concurrency: group: codecov-master-baseline-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: upload_unit_coverage: timeout-minutes: 30 name: Upload unit coverage to Codecov (master) runs-on: latchkey-small steps: - name: Checkout repo uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 1 - name: Set up Go uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6 with: cache: true cache-dependency-path: go.sum go-version-file: go.mod - name: Run unit tests with coverage run: make -e GO_TEST_FLAGS="-race -coverpkg=github.com/kiali/kiali/... -coverprofile=coverage-unit.out" test - name: Upload coverage to Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: disable_search: true fail_ci_if_error: true files: coverage-unit.out flags: integration override_branch: ${{ github.ref_name }} override_commit: ${{ github.sha }} slug: kiali/kiali token: ${{ secrets.CODECOV_TOKEN }} use_pypi: true
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. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.