Skip to content
Latchkey

Build Backend workflow (kiali/kiali)

The Build Backend 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.

Grade your own workflow free or run it on Latchkey →
Source: kiali/kiali.github/workflows/build-backend.ymlLicense Apache-2.0View source

What it does

This is the Build Backend 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)
name: Build Backend

on:
  workflow_call:
    inputs:
      build_branch:
        required: true
        type: string
jobs:
  build_backend:
    name: Build backend binary
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      with:
        ref: ${{ inputs.build_branch }}

    - name: Set up Go
      uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
      with:
        go-version-file: go.mod
        cache: true
        cache-dependency-path: go.sum

    - name: Download frontend build
      uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
      with:
        name: build
        path: frontend/build

    - name: Build
      run: make -e GO_BUILD_FLAGS=${{ env.GO_BUILD_FLAGS }} -e CGO_ENABLED=${{ env.CGO_ENABLED }} clean build
      env:
        # Build with -race flag if this is a PR, otherwise it is a release and
        # we don't want to build with race detection because of the perf penalty.
        GO_BUILD_FLAGS: ${{ github.base_ref && '-race' }}
        # The -race flag requires CGO_ENABLED
        CGO_ENABLED: ${{ github.base_ref && '1' }}

    - name: Upload go binary
      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
      with:
        name: kiali
        path: ~/go/bin/kiali

The same workflow, on Latchkey

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

name: Build Backend
 
on:
  workflow_call:
    inputs:
      build_branch:
        required: true
        type: string
jobs:
  build_backend:
    timeout-minutes: 30
    name: Build backend binary
    runs-on: latchkey-small
    steps:
    - name: Checkout code
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      with:
        ref: ${{ inputs.build_branch }}
 
    - name: Set up Go
      uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
      with:
        go-version-file: go.mod
        cache: true
        cache-dependency-path: go.sum
 
    - name: Download frontend build
      uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
      with:
        name: build
        path: frontend/build
 
    - name: Build
      run: make -e GO_BUILD_FLAGS=${{ env.GO_BUILD_FLAGS }} -e CGO_ENABLED=${{ env.CGO_ENABLED }} clean build
      env:
        # Build with -race flag if this is a PR, otherwise it is a release and
        # we don't want to build with race detection because of the perf penalty.
        GO_BUILD_FLAGS: ${{ github.base_ref && '-race' }}
        # The -race flag requires CGO_ENABLED
        CGO_ENABLED: ${{ github.base_ref && '1' }}
 
    - name: Upload go binary
      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
      with:
        name: kiali
        path: ~/go/bin/kiali
 

What changed

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