Skip to content

Prepare for public release (0.3.0) #390

Prepare for public release (0.3.0)

Prepare for public release (0.3.0) #390

Workflow file for this run

name: Run checks on push or PR to main
on:
push:
branches: [main]
pull_request:
branches:
- main
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "0.5.29"
enable-cache: true
- run: uv sync
- run: uv run --frozen ruff check
if: success() || failure()
- run: uv run --frozen ruff format --check
if: success() || failure()
- run: uv run --frozen pyright
if: success() || failure()
##
get-python-pytorch-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.get-versions.outputs.versions }}
steps:
- name: "Get (Python, PyTorch) versions"
id: get-versions
run: |
pytorch_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$//'
)
version_matrix=()
for pytorch_version in $pytorch_versions; do
cp_versions=$(curl -s "https://pypi.org/pypi/torch/$pytorch_version/json" | jq -r '.urls[].filename | select(test("manylinux1_x86_64")) | capture("(?<cp>cp[0-9]+)-") | .cp')
for cp_version in $cp_versions; do
python_version=$(echo $cp_version | sed -E 's/cp([0-9])([0-9]+)/\1.\2/')
version_matrix+=($python_version,$pytorch_version)
done
done
version_matrix=$(printf '%s\n' "${version_matrix[@]}" | jq -R . | jq -s -c .)
echo "versions=$version_matrix" >> $GITHUB_OUTPUT
# e.g. [ "3.10,2.0", "3.11,2.0", "3.8,2.0", ... ]
test:
runs-on: ubuntu-latest
needs: get-python-pytorch-versions
strategy:
fail-fast: false
matrix:
versions: ${{fromJson(needs.get-python-pytorch-versions.outputs.versions)}}
steps:
- run: echo ${{ matrix.versions }}
# - uses: actions/checkout@v4
# - uses: astral-sh/setup-uv@v5
# with:
# version: "0.5.29"
# - if: contains('2.0,2.1,2.2', matrix.pytorch)
# run: echo "NUMPY_VERSION=--with \"numpy<2\"" >> $GITHUB_ENV
# - run: uv run --python ${{ matrix.python }} --with torch~=${{ matrix.pytorch }} ${{ env.NUMPY_VERSION }} pytest --verbose tests/test_ci.py
publish-docs:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "0.5.29"
- run: uv run --group docs python -m sphinx --builder html --doctree-dir docs/_build/.doctrees --conf-dir docs --show-traceback docs/source docs/_build/html
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html
- id: deployment
uses: actions/deploy-pages@v4