Skip to content

switch from pixi to uv #255

switch from pixi to uv

switch from pixi to uv #255

Workflow file for this run

name: Run checks on push or PR to main
on:
push:
branches: [main]
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- run: uv sync
- run: uv run ruff check
if: success() || failure()
- run: uv run ruff format --check
if: success() || failure()
##
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- run: uv sync
- run: uv run pyright
if: success() || failure()
##
get-pytorch-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.get-pytorch-versions.outputs.versions }}
steps:
- name: Get PyTorch versions
id: get-pytorch-versions
run: |
VERSIONS=$(
curl -s https://pypi.org/pypi/torch/json | jq -r '.releases | keys[]' |
# remove versions <2.0; strip "patch" from versions
grep -v '^1\.' | grep -E '\.[0]+$' | sort -V | sed 's/\.0$//' |
# to JSON array
jq -R . | jq -sc .
)
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
# e.g. ["2.0","2.1","2.2","2.3","2.4"]
test:
runs-on: ubuntu-latest
needs: get-pytorch-versions
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
pytorch: ${{fromJson(needs.get-pytorch-versions.outputs.versions)}}
steps:
- uses: actions/checkout@v4
- name: Override pytorch version
run: sed -i 's/constraint-dependencies = \["torch>=2.1.1"\]/constraint-dependencies = \["torch==${{ matrix.pytorch }}"\]/' pyproject.toml
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- run: uv sync --python ${{ matrix.python }}
- run: uv run pytest tests/test_ci.py