diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5d382955 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + tags: + # Publish on any tag starting with a `v`, e.g., v1.2.3 + - v* + workflow_dispatch: + +jobs: + pypi: + name: Publish to PyPI + runs-on: ubuntu-latest + # Environment and permissions trusted publishing. + environment: + # Create this environment in the GitHub repository under Settings -> Environments + name: pypi + permissions: + id-token: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v5 + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Install Python 3.13 + run: uv python install 3.13 + - name: Build + run: uv build + # Check that basic features work and we didn't miss to include crucial files + - name: Smoke test (wheel) + run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py + - name: Smoke test (source distribution) + run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py + - name: Publish + run: uv publish diff --git a/tests/smoke_test.py b/tests/smoke_test.py new file mode 100644 index 00000000..c7746a23 --- /dev/null +++ b/tests/smoke_test.py @@ -0,0 +1,9 @@ +"""Check that basic features work. + +Catch cases where e.g. files are missing so the import doesn't work. It is +recommended to check that e.g. assets are included.""" + +import populationsim + +if populationsim is not None: + print("Smoke test succeeded")