diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..6ac383fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,110 @@ +name: Release + +# Publishes the pure-Python nvsubquadratic wheel + sdist to PyPI on a +# `vX.Y.Z` tag push (or manual dispatch with an existing tag). +# +# Routing: +# - prerelease tags containing "rc" (e.g. v0.1.0rc1) -> TestPyPI +# - final tags (e.g. v0.1.0) -> PyPI +# +# Auth is OIDC "trusted publisher" — no API token secret. One-time setup +# required before the first run: +# 1. On pypi.org and test.pypi.org, add a trusted publisher for this repo +# pointing at workflow `release.yml` and the matching environment below. +# 2. Create GitHub environments named `pypi` and `testpypi` +# (Settings -> Environments). +# The package version is read from the VERSION file; the build job fails fast +# if the tag does not match it, so bump VERSION before tagging. + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + inputs: + tag: + description: "Existing tag to build & publish (e.g. v0.1.0 or v0.1.0rc1)" + required: true + +permissions: + contents: read + +concurrency: + group: release-${{ github.event.inputs.tag || github.ref_name }} + cancel-in-progress: false + +jobs: + build: + name: Build sdist + wheel + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.tag || github.ref }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Verify tag matches VERSION + run: | + TAG="${{ github.event.inputs.tag || github.ref_name }}" + TAG_VER="${TAG#v}" + FILE_VER="$(tr -d '[:space:]' < VERSION)" + if [ "$TAG_VER" != "$FILE_VER" ]; then + echo "::error::Tag $TAG (version $TAG_VER) does not match VERSION file ($FILE_VER). Bump VERSION before tagging." + exit 1 + fi + echo "Tag $TAG matches VERSION $FILE_VER" + + - name: Build + run: | + python -m pip install --upgrade pip build twine + python -m build + twine check dist/* + + - name: Upload dist artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish-testpypi: + name: Publish to TestPyPI (prerelease) + needs: build + if: contains(github.event.inputs.tag || github.ref_name, 'rc') + runs-on: ubuntu-latest + environment: testpypi + permissions: + id-token: write + steps: + - name: Download dist + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + publish-pypi: + name: Publish to PyPI (final release) + needs: build + if: ${{ !contains(github.event.inputs.tag || github.ref_name, 'rc') }} + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + steps: + - name: Download dist + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.md b/README.md index 28b0164b..4ae37ceb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ nvSubquadratic consolidates efforts from across NVIDIA Research teams (nvResearc **Requirements**: -- CUDA-compatible NVIDIA GPU (Ampere or Hopper architecture) +- CUDA-compatible NVIDIA GPU (Ampere or newer) - CUDA Toolkit 12.0 or higher - Python 3.11 or higher diff --git a/docs/getting_started.md b/docs/getting_started.md index aa90d4c9..c04e5d6f 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -6,7 +6,7 @@ Apptainer, conda, venv) see the project [README](https://github.com/NVIDIA-BioNe ## Requirements -- CUDA-compatible NVIDIA GPU (Ampere or Hopper architecture) +- CUDA-compatible NVIDIA GPU (Ampere or newer) - CUDA Toolkit 12.0 or higher - Python 3.11 or higher diff --git a/docs/index.rst b/docs/index.rst index 41e055c9..b37cf38e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -30,7 +30,7 @@ To enable the optional fused RMSNorm kernel on Hopper / Blackwell GPUs: Requirements ------------ -- CUDA-compatible NVIDIA GPU (Ampere or Hopper architecture) +- CUDA-compatible NVIDIA GPU (Ampere or newer) - CUDA Toolkit 12.0 or higher - Python 3.11 or higher