Skip to content
Latchkey

CI workflow (s3prl/s3prl)

The CI workflow from s3prl/s3prl, explained and optimized by Latchkey.

F

CI health: F - at risk

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

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

What it does

This is the CI workflow from the s3prl/s3prl 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: CI

on:
  # Trigger the workflow on push to main or any pull request
  push:
    branches:
      - main
  pull_request:

jobs:
  build-and-test:

    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        python-version: ["3.10"]
        torchaudio-version: [0.13.1, 2.0.1, 2.1.2, 2.2.2, 2.3.1, 2.4.0]
        include:
          - os: ubuntu-latest
            python-version: 3.9
            torchaudio-version: 0.13.1
          - os: ubuntu-latest
            python-version: "3.11"
            torchaudio-version: 2.1.2
          - os: ubuntu-latest
            python-version: "3.12"  # if not quoted, will be interpreted as 3.1
            torchaudio-version: 2.3.1

    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v2

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install Linux dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -y libsndfile1-dev sox git git-lfs

    - name: Upgrade pip and wheel
      run: pip3 install --upgrade pip wheel setuptools

    - name: Install dependencies for tests
      run: pip3 install -r requirements/dev.txt

    - name: Check coding style by ci/format.py
      run: |
        ./ci/format.py --check

    - name: Clean Docker space
      run: docker system prune -af

    # This can be very helpful for debugging
    # The action can create a SSH server for you to connect. After you
    # log into the machine hosted by GitHub, it becomes easy to debug
    # why the CI fails on a specific machine.

    # - name: Setup upterm session
    #   uses: lhotari/action-upterm@v1

    - name: Run tox for common upstream
      run: |
        tox -e common_upstream-audio${{ matrix.torchaudio-version }}

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: CI
 
on:
  # Trigger the workflow on push to main or any pull request
  push:
    branches:
      - main
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-and-test:
    timeout-minutes: 30
 
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        python-version: ["3.10"]
        torchaudio-version: [0.13.1, 2.0.1, 2.1.2, 2.2.2, 2.3.1, 2.4.0]
        include:
          - os: ubuntu-latest
            python-version: 3.9
            torchaudio-version: 0.13.1
          - os: ubuntu-latest
            python-version: "3.11"
            torchaudio-version: 2.1.2
          - os: ubuntu-latest
            python-version: "3.12"  # if not quoted, will be interpreted as 3.1
            torchaudio-version: 2.3.1
 
    runs-on: ${{ matrix.os }}
 
    steps:
    - uses: actions/checkout@v2
 
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        cache: 'pip'
        python-version: ${{ matrix.python-version }}
 
    - name: Install Linux dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -y libsndfile1-dev sox git git-lfs
 
    - name: Upgrade pip and wheel
      run: pip3 install --upgrade pip wheel setuptools
 
    - name: Install dependencies for tests
      run: pip3 install -r requirements/dev.txt
 
    - name: Check coding style by ci/format.py
      run: |
        ./ci/format.py --check
 
    - name: Clean Docker space
      run: docker system prune -af
 
    # This can be very helpful for debugging
    # The action can create a SSH server for you to connect. After you
    # log into the machine hosted by GitHub, it becomes easy to debug
    # why the CI fails on a specific machine.
 
    # - name: Setup upterm session
    #   uses: lhotari/action-upterm@v1
 
    - name: Run tox for common upstream
      run: |
        tox -e common_upstream-audio${{ matrix.torchaudio-version }}
 

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.

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 (6 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