CI workflow (s3prl/s3prl)
The CI workflow from s3prl/s3prl, explained and optimized by Latchkey.
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 →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
name: CI
on:
# Trigger the workflow on push to main or any pull request
push:
branches:
- main
pull_request:
jobs:
espnet-upstream:
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]
# espnet use 'torchaudio.models.hubert_pretrain_model' with 'feature_grad_mult' option
# which is available after torchaudio==0.12.0
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
# 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 espnet-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: espnet-upstream: 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] # espnet use 'torchaudio.models.hubert_pretrain_model' with 'feature_grad_mult' option # which is available after torchaudio==0.12.0 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 # 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 espnet-audio${{ matrix.torchaudio-version }}
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
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:
- Dependency installs
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.