Skip to content

Craft object detection #163

Craft object detection

Craft object detection #163

Workflow file for this run

name: tests torch
on:
pull_request:
workflow_dispatch:
jobs:
discover-tox-envs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- name: Set up Python (from pyproject)
uses: actions/setup-python@v6
with:
python-version-file: pyproject.toml
- name: Set up uv
uses: astral-sh/setup-uv@v6
- name: Install tox tooling
run: |
uv pip install --system tox tox-uv pytest
- name: Build matrix from tox.ini
id: build-matrix
run: |
python - <<'PY'
import json
import os
import subprocess
envs = subprocess.check_output(["tox", "-l"], text=True).splitlines()
envs = [e.strip() for e in envs if e.strip().startswith("py")]
envs = [e for e in envs if "-torch" in e]
matrix = {"toxenv": envs}
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f:
f.write(f"matrix={json.dumps(matrix)}\n")
PY
checks:
needs: discover-tox-envs
runs-on: ubuntu-latest
# The 'fail-fast' strategy option determines whether to cancel all in-progress jobs
# if any matrix job fails. When set to 'false', failed jobs do not cancel other
# running jobs, allowing all matrix combinations to complete independently.
# This is useful for testing across multiple configurations to see all failures.
strategy:
fail-fast: false
matrix:
toxenv: ${{ fromJson(needs.discover-tox-envs.outputs.matrix).toxenv }}
steps:
- uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v6
- name: Create virtualenv and install tox
run: |
uv venv
. .venv/bin/activate
uv pip install --upgrade pip
uv pip install tox tox-uv
- name: Test with tox (${{ matrix.toxenv }})
run: |
. .venv/bin/activate
tox -e ${{ matrix.toxenv }}