Skip to content
Latchkey

End-to-end tests workflow (tus/tusd)

The End-to-end tests 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/e2e.yamlLicense MITView source

What it does

This is the End-to-end tests 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: End-to-end tests

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  e2e:
    strategy:
      fail-fast: false
      matrix:
        backend: [file, s3, azure, gcs]
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout code
        uses: actions/checkout@v7

      -
        name: Install Go
        uses: actions/setup-go@v6
        with:
          go-version: stable

      -
        name: Set tusd output
        run: |
          echo "TUSD_BINARY=$PWD/tusd" >> $GITHUB_ENV

      -
        name: Build tusd
        run: |
          go build -o $TUSD_BINARY ./cmd/tusd/main.go

      # --- S3 (MinIO) ---
      -
        name: Start MinIO
        if: matrix.backend == 's3'
        run: |
          docker run -d -p 9000:9000 \
            -e MINIO_ROOT_USER=minioadmin \
            -e MINIO_ROOT_PASSWORD=minioadmin \
            --name minio \
            minio/minio server /data
          for i in $(seq 1 30); do
            if curl -s http://localhost:9000/minio/health/live > /dev/null 2>&1; then
              break
            fi
            if [ "$i" -eq 30 ]; then exit 1; fi
            sleep 1
          done

      -
        name: Create S3 bucket
        if: matrix.backend == 's3'
        run: |
          docker run --rm \
            -e AWS_ACCESS_KEY_ID=minioadmin \
            -e AWS_SECRET_ACCESS_KEY=minioadmin \
            -e AWS_DEFAULT_REGION=us-east-1 \
            --add-host=host.docker.internal:host-gateway \
            amazon/aws-cli s3 mb s3://e2e --endpoint-url http://host.docker.internal:9000

      -
        name: Set S3 env
        if: matrix.backend == 's3'
        run: |
          echo "AWS_ACCESS_KEY_ID=minioadmin" >> $GITHUB_ENV
          echo "AWS_SECRET_ACCESS_KEY=minioadmin" >> $GITHUB_ENV
          echo "AWS_REGION=us-east-1" >> $GITHUB_ENV
          echo "TUSD_EXTRA_ARGS=-s3-bucket=e2e -s3-endpoint=http://localhost:9000 -s3-disable-ssl" >> $GITHUB_ENV

      # --- Azure (Azurite) ---
      -
        name: Start Azurite
        if: matrix.backend == 'azure'
        run: |
          docker run -d -p 10000:10000 \
            --name azurite \
            mcr.microsoft.com/azure-storage/azurite azurite-blob --blobHost 0.0.0.0 --skipApiVersionCheck
          for i in $(seq 1 30); do
            if curl -s -o /dev/null http://127.0.0.1:10000/devstoreaccount1?restype=account; then
              break
            fi
            if [ "$i" -eq 30 ]; then exit 1; fi
            sleep 1
          done

      -
        name: Create Azure container
        if: matrix.backend == 'azure'
        run: |
          docker run --rm \
            --add-host=host.docker.internal:host-gateway \
            mcr.microsoft.com/azure-cli az storage container create -n e2e --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://host.docker.internal:10000/devstoreaccount1;"

      -
        name: Set Azure env
        if: matrix.backend == 'azure'
        run: |
          echo "AZURE_STORAGE_ACCOUNT=devstoreaccount1" >> $GITHUB_ENV
          echo "AZURE_STORAGE_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" >> $GITHUB_ENV
          echo "TUSD_EXTRA_ARGS=-azure-storage=e2e -azure-endpoint=http://127.0.0.1:10000/devstoreaccount1" >> $GITHUB_ENV

      # --- GCS (fake-gcs-server) ---
      -
        name: Start fake-gcs-server
        if: matrix.backend == 'gcs'
        run: |
          mkdir -p gcs-data/e2e
          docker run -d -p 4443:4443 -v $PWD/gcs-data:/storage --name fake-gcs \
            fsouza/fake-gcs-server -scheme http
          for i in $(seq 1 30); do
            if curl -s -o /dev/null http://127.0.0.1:4443/storage/v1/b; then
              break
            fi
            if [ "$i" -eq 30 ]; then exit 1; fi
            sleep 1
          done

      -
        name: Set GCS env
        if: matrix.backend == 'gcs'
        run: |
          echo "STORAGE_EMULATOR_HOST=http://127.0.0.1:4443" >> $GITHUB_ENV
          echo "TUSD_EXTRA_ARGS=-gcs-bucket=e2e -gcs-endpoint=http://127.0.0.1:4443/storage/v1/" >> $GITHUB_ENV

      # --- Run tests ---
      -
        name: Run e2e tests
        run: |
          go test -race ./internal/e2e/...

The same workflow, on Latchkey

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

name: End-to-end tests
 
on:
  push:
    branches:
      - main
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  e2e:
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        backend: [file, s3, azure, gcs]
    runs-on: latchkey-small
    steps:
      -
        name: Checkout code
        uses: actions/checkout@v7
 
      -
        name: Install Go
        uses: actions/setup-go@v6
        with:
          go-version: stable
 
      -
        name: Set tusd output
        run: |
          echo "TUSD_BINARY=$PWD/tusd" >> $GITHUB_ENV
 
      -
        name: Build tusd
        run: |
          go build -o $TUSD_BINARY ./cmd/tusd/main.go
 
      # --- S3 (MinIO) ---
      -
        name: Start MinIO
        if: matrix.backend == 's3'
        run: |
          docker run -d -p 9000:9000 \
            -e MINIO_ROOT_USER=minioadmin \
            -e MINIO_ROOT_PASSWORD=minioadmin \
            --name minio \
            minio/minio server /data
          for i in $(seq 1 30); do
            if curl -s http://localhost:9000/minio/health/live > /dev/null 2>&1; then
              break
            fi
            if [ "$i" -eq 30 ]; then exit 1; fi
            sleep 1
          done
 
      -
        name: Create S3 bucket
        if: matrix.backend == 's3'
        run: |
          docker run --rm \
            -e AWS_ACCESS_KEY_ID=minioadmin \
            -e AWS_SECRET_ACCESS_KEY=minioadmin \
            -e AWS_DEFAULT_REGION=us-east-1 \
            --add-host=host.docker.internal:host-gateway \
            amazon/aws-cli s3 mb s3://e2e --endpoint-url http://host.docker.internal:9000
 
      -
        name: Set S3 env
        if: matrix.backend == 's3'
        run: |
          echo "AWS_ACCESS_KEY_ID=minioadmin" >> $GITHUB_ENV
          echo "AWS_SECRET_ACCESS_KEY=minioadmin" >> $GITHUB_ENV
          echo "AWS_REGION=us-east-1" >> $GITHUB_ENV
          echo "TUSD_EXTRA_ARGS=-s3-bucket=e2e -s3-endpoint=http://localhost:9000 -s3-disable-ssl" >> $GITHUB_ENV
 
      # --- Azure (Azurite) ---
      -
        name: Start Azurite
        if: matrix.backend == 'azure'
        run: |
          docker run -d -p 10000:10000 \
            --name azurite \
            mcr.microsoft.com/azure-storage/azurite azurite-blob --blobHost 0.0.0.0 --skipApiVersionCheck
          for i in $(seq 1 30); do
            if curl -s -o /dev/null http://127.0.0.1:10000/devstoreaccount1?restype=account; then
              break
            fi
            if [ "$i" -eq 30 ]; then exit 1; fi
            sleep 1
          done
 
      -
        name: Create Azure container
        if: matrix.backend == 'azure'
        run: |
          docker run --rm \
            --add-host=host.docker.internal:host-gateway \
            mcr.microsoft.com/azure-cli az storage container create -n e2e --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://host.docker.internal:10000/devstoreaccount1;"
 
      -
        name: Set Azure env
        if: matrix.backend == 'azure'
        run: |
          echo "AZURE_STORAGE_ACCOUNT=devstoreaccount1" >> $GITHUB_ENV
          echo "AZURE_STORAGE_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" >> $GITHUB_ENV
          echo "TUSD_EXTRA_ARGS=-azure-storage=e2e -azure-endpoint=http://127.0.0.1:10000/devstoreaccount1" >> $GITHUB_ENV
 
      # --- GCS (fake-gcs-server) ---
      -
        name: Start fake-gcs-server
        if: matrix.backend == 'gcs'
        run: |
          mkdir -p gcs-data/e2e
          docker run -d -p 4443:4443 -v $PWD/gcs-data:/storage --name fake-gcs \
            fsouza/fake-gcs-server -scheme http
          for i in $(seq 1 30); do
            if curl -s -o /dev/null http://127.0.0.1:4443/storage/v1/b; then
              break
            fi
            if [ "$i" -eq 30 ]; then exit 1; fi
            sleep 1
          done
 
      -
        name: Set GCS env
        if: matrix.backend == 'gcs'
        run: |
          echo "STORAGE_EMULATOR_HOST=http://127.0.0.1:4443" >> $GITHUB_ENV
          echo "TUSD_EXTRA_ARGS=-gcs-bucket=e2e -gcs-endpoint=http://127.0.0.1:4443/storage/v1/" >> $GITHUB_ENV
 
      # --- Run tests ---
      -
        name: Run e2e tests
        run: |
          go test -race ./internal/e2e/...
 

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 1 job (4 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