Test workflow (torchmd/torchmd-net)
The Test workflow from torchmd/torchmd-net, explained and optimized by Latchkey.
CI health: B - good
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 Test workflow from the torchmd/torchmd-net 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: Test
on:
workflow_dispatch:
workflow_call:
schedule:
- cron: "0 0 * * 0" # Run every Sunday at 0:00
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
["ubuntu-latest", "ubuntu-22.04-arm", "macos-latest", "windows-2022"]
python-version: ["3.13"]
steps:
- name: Check out
uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- name: Set up MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install the project
run: uv sync --all-extras --dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
uv run flake8 ./torchmdnet --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
uv run flake8 ./torchmdnet --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests
env:
PYTORCH_ENABLE_MPS_FALLBACK: ${{ startsWith(matrix.os, 'macos') && '1' || '' }}
run: uv run pytest tests
- name: Test torchmd-train utility
run: uv run torchmd-train --help
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Test on: workflow_dispatch: workflow_call: schedule: - cron: "0 0 * * 0" # Run every Sunday at 0:00 jobs: test: timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: ["ubuntu-latest", "ubuntu-22.04-arm", "macos-latest", "windows-2022"] python-version: ["3.13"] steps: - name: Check out uses: actions/checkout@v5 - name: Install uv uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} - name: Set up MSVC (Windows) if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 - name: Install the project run: uv sync --all-extras --dev - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names uv run flake8 ./torchmdnet --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide uv run flake8 ./torchmdnet --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Run tests env: PYTORCH_ENABLE_MPS_FALLBACK: ${{ startsWith(matrix.os, 'macos') && '1' || '' }} run: uv run pytest tests - name: Test torchmd-train utility run: uv run torchmd-train --help
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
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.