Prepare for public release (0.3.0
)
#383
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-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 | |
- 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 |