Skip to content

Updated the model factory to match Aurora v2.0.1 release. #5

Updated the model factory to match Aurora v2.0.1 release.

Updated the model factory to match Aurora v2.0.1 release. #5

Workflow file for this run

name: Release to PyPI
on:
push:
branches:
- master
- main
tags:
- "v*"
pull_request:
permissions:
contents: read
jobs:
test:
name: Test (CPU, no GPU required)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v9.0.0
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PACKAGE_VERSION="$(uv run --python 3.12 --no-project python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
if [ "${TAG_VERSION}" != "${PACKAGE_VERSION}" ]; then
echo "::error::Tag '${GITHUB_REF_NAME}' does not match pyproject version '${PACKAGE_VERSION}'. Refusing to release."
exit 1
fi
echo "Tag ${GITHUB_REF_NAME} matches pyproject version ${PACKAGE_VERSION}."
- name: Sync dependencies from official PyPI
env:
UV_DEFAULT_INDEX: https://pypi.org/simple
run: uv sync --extra dev --python 3.12
- name: Run full test suite
env:
UV_DEFAULT_INDEX: https://pypi.org/simple
run: uv run --python 3.12 pytest -m "not integration" -q
build:
name: Build distributions
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v9.0.0
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Build wheel and sdist
run: uv build --python 3.12
- name: Verify wheel contents
run: |
uv run --python 3.12 --no-project python -c '
import glob
import zipfile
wheels = glob.glob("dist/*.whl")
assert len(wheels) == 1, f"expected exactly one wheel, got {wheels}"
with zipfile.ZipFile(wheels[0]) as archive:
names = archive.namelist()
for required in (
"flash_aurora/__init__.py",
"flash_aurora/models/aurora/LICENSE.txt",
"flash_aurora/models/aurora_v1p5/LICENSE.txt",
):
assert required in names, f"{required} missing from {wheels[0]}"
print(f"wheel {wheels[0]} contains {len(names)} files")
'
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: pypi-dist
path: dist/
publish:
name: Publish to PyPI
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v9.0.0
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: pypi-dist
path: dist/
- name: Publish to PyPI
run: uv publish --publish-url https://upload.pypi.org/legacy/