Testing workflow (learnables/learn2learn)
The Testing workflow from learnables/learn2learn, explained and optimized by Latchkey.
CI health: C - fair
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 Testing workflow from the learnables/learn2learn 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
name: Testing
on: [push, pull_request, create]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-latest, macos-latest]
python: ['3.8']
pytorch: ['1.4.0', '1.5.0', '1.6.0', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.13.1']
include:
- pytorch: '1.4.0'
torchvision: '0.5.0'
- pytorch: '1.5.0'
torchvision: '0.6.0'
- pytorch: '1.6.0'
torchvision: '0.7.0'
- pytorch: '1.7.0'
torchvision: '0.8.0'
- pytorch: '1.8.0'
torchvision: '0.9.0'
- pytorch: '1.9.0'
torchvision: '0.10.0'
- pytorch: '1.10.0'
torchvision: '0.11.1'
- pytorch: '1.13.1'
torchvision: '0.14.0'
exclude:
- pytorch: '1.3.0'
python: '3.8'
- pytorch: '1.4.0'
python: '3.9'
- pytorch: '1.5.0'
python: '3.9'
- pytorch: '1.6.0'
python: '3.9'
- pytorch: '1.7.0'
python: '3.9'
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
architecture: x64
- name: Install Dependencies
run: |
python3 --version
python3 -m pip install -U pip
pip3 install cython pybind11
pip3 install scipy==1.10.1
pip3 install torch==${{ matrix.pytorch }}
pip3 install torchvision==${{ matrix.torchvision }}
pip3 install chardet==3.0.4 # can be remove when fix in: https://github.com/aio-libs/aiohttp/issues/5366
pip3 install requests numpy gym gsutil tqdm
make dev
- name: Lint Code
run: make lint
- name: Run Tests
run: make tests
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: Testing on: [push, pull_request, create] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: tests: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-22.04, ubuntu-latest, macos-latest] python: ['3.8'] pytorch: ['1.4.0', '1.5.0', '1.6.0', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.13.1'] include: - pytorch: '1.4.0' torchvision: '0.5.0' - pytorch: '1.5.0' torchvision: '0.6.0' - pytorch: '1.6.0' torchvision: '0.7.0' - pytorch: '1.7.0' torchvision: '0.8.0' - pytorch: '1.8.0' torchvision: '0.9.0' - pytorch: '1.9.0' torchvision: '0.10.0' - pytorch: '1.10.0' torchvision: '0.11.1' - pytorch: '1.13.1' torchvision: '0.14.0' exclude: - pytorch: '1.3.0' python: '3.8' - pytorch: '1.4.0' python: '3.9' - pytorch: '1.5.0' python: '3.9' - pytorch: '1.6.0' python: '3.9' - pytorch: '1.7.0' python: '3.9' steps: - name: Clone Repository uses: actions/checkout@v3 with: ref: ${{ github.ref }} - name: Set up Python uses: actions/setup-python@v4 with: cache: 'pip' python-version: ${{ matrix.python }} cache: 'pip' architecture: x64 - name: Install Dependencies run: | python3 --version python3 -m pip install -U pip pip3 install cython pybind11 pip3 install scipy==1.10.1 pip3 install torch==${{ matrix.pytorch }} pip3 install torchvision==${{ matrix.torchvision }} pip3 install chardet==3.0.4 # can be remove when fix in: https://github.com/aio-libs/aiohttp/issues/5366 pip3 install requests numpy gym gsutil tqdm make dev - name: Lint Code run: make lint - name: Run Tests run: make tests
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.
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 (24 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.