Run basic tests on all OS workflow (wasserth/TotalSegmentator)
The Run basic tests on all OS workflow from wasserth/TotalSegmentator, 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 Run basic tests on all OS workflow from the wasserth/TotalSegmentator 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: Run basic tests on all OS
on:
push:
paths-ignore:
- '**.md'
jobs:
run-tests:
strategy:
matrix:
# os: [ubuntu-latest, windows-latest, macos-latest] # fails on windows until https://github.com/MIC-DKFZ/nnUNet/issues/2396 is resolved
os: [ubuntu-latest, macos-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Free Disk Space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies on Ubuntu
if: runner.os == 'Linux'
run: |
python -m pip install --upgrade pip
pip install pytest Cython fury
pip install torch==2.4.0 -f https://download.pytorch.org/whl/cpu
pip install .
- name: Install dependencies on Windows / MacOS
if: runner.os == 'Windows' || runner.os == 'macOS'
run: |
python -m pip install --upgrade pip
pip install pytest Cython
pip install torch==2.4.0
pip install .
- name: Run test script
run: python tests/tests_os.py
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Run basic tests on all OS on: push: paths-ignore: - '**.md' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: run-tests: timeout-minutes: 30 strategy: matrix: # os: [ubuntu-latest, windows-latest, macos-latest] # fails on windows until https://github.com/MIC-DKFZ/nnUNet/issues/2396 is resolved os: [ubuntu-latest, macos-latest] python-version: ["3.11"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 - name: Free Disk Space (Ubuntu) if: runner.os == 'Linux' uses: jlumbroso/free-disk-space@main with: tool-cache: false android: true dotnet: true haskell: true large-packages: true docker-images: true swap-storage: true - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} cache: 'pip' - name: Install dependencies on Ubuntu if: runner.os == 'Linux' run: | python -m pip install --upgrade pip pip install pytest Cython fury pip install torch==2.4.0 -f https://download.pytorch.org/whl/cpu pip install . - name: Install dependencies on Windows / MacOS if: runner.os == 'Windows' || runner.os == 'macOS' run: | python -m pip install --upgrade pip pip install pytest Cython pip install torch==2.4.0 pip install . - name: Run test script run: python tests/tests_os.py
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- 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 (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.