Skip to content
Latchkey

continuous-integration workflow (tus/tusd)

The continuous-integration workflow from tus/tusd, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, 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: tus/tusd.github/workflows/continuous-integration.yamlLicense MITView source

What it does

This is the continuous-integration workflow from the tus/tusd 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: continuous-integration

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        go-version: [stable, oldstable]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
      -
        name: Checkout code
        uses: actions/checkout@v7

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

      -
        name: Clean module files
        run: |
          go mod tidy
        shell: bash

      -
        name: Set tusd output
        run: |
          TUSD_BINARY=$PWD/tusd
          if [ "$RUNNER_OS" = "Windows" ]; then
            TUSD_BINARY="$TUSD_BINARY.exe"
          fi
          echo "TUSD_BINARY=$TUSD_BINARY" >> $GITHUB_ENV
        shell: bash

      -
        name: Compile tusd binary
        run: |
          go build -o $TUSD_BINARY ./cmd/tusd/main.go
        shell: bash

      -
        name: Test code
        run: |
          go test -race ./pkg/...
          go test -race ./internal/grouped_flags/... ./internal/s3log/...
        shell: bash

      -
        name: Vet code
        run: |
          go vet ./pkg/...
          go vet ./internal/...
        shell: bash

  pages:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: docs
    steps:
      - name: Checkout
        uses: actions/checkout@v7
      - name: Setup Ruby
        uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601
        with:
          ruby-version: '3.3' # Not needed with a .ruby-version file
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
          cache-version: 0 # Increment this number if you need to re-download cached gems
          working-directory: '${{ github.workspace }}/docs'
      - name: Build with Jekyll
        run: bundle exec jekyll build

The same workflow, on Latchkey

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

name: continuous-integration
 
on:
  push:
    branches:
      - main
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        go-version: [stable, oldstable]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
      -
        name: Checkout code
        uses: actions/checkout@v7
 
      -
        name: Install Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go-version }}
 
      -
        name: Clean module files
        run: |
          go mod tidy
        shell: bash
 
      -
        name: Set tusd output
        run: |
          TUSD_BINARY=$PWD/tusd
          if [ "$RUNNER_OS" = "Windows" ]; then
            TUSD_BINARY="$TUSD_BINARY.exe"
          fi
          echo "TUSD_BINARY=$TUSD_BINARY" >> $GITHUB_ENV
        shell: bash
 
      -
        name: Compile tusd binary
        run: |
          go build -o $TUSD_BINARY ./cmd/tusd/main.go
        shell: bash
 
      -
        name: Test code
        run: |
          go test -race ./pkg/...
          go test -race ./internal/grouped_flags/... ./internal/s3log/...
        shell: bash
 
      -
        name: Vet code
        run: |
          go vet ./pkg/...
          go vet ./internal/...
        shell: bash
 
  pages:
    timeout-minutes: 30
    runs-on: latchkey-small
    defaults:
      run:
        working-directory: docs
    steps:
      - name: Checkout
        uses: actions/checkout@v7
      - name: Setup Ruby
        uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601
        with:
          ruby-version: '3.3' # Not needed with a .ruby-version file
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
          cache-version: 0 # Increment this number if you need to re-download cached gems
          working-directory: '${{ github.workspace }}/docs'
      - name: Build with Jekyll
        run: bundle exec jekyll build
 

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 2 jobs (7 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