-
Notifications
You must be signed in to change notification settings - Fork 5
ci(PLT-1250): tag-triggered PyPI release pipeline #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
175cd09
76d8577
42c7a19
5e3ff40
76fef6f
dbd8724
2b98e2d
59cc6f1
7772bb5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: License check | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| license-check: | ||
| name: License check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # required: hatch-vcs runs during uv sync | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --locked --dev | ||
|
|
||
| - name: Check dependency licenses | ||
| run: >- | ||
| uv run pip-licenses | ||
| --allow-only="MIT;Apache-2.0;Apache 2.0;Apache Software License;BSD-2-Clause;BSD-3-Clause;BSD License;BSD;ISC;LGPL-3.0-only;MPL-2.0;Mozilla Public License;Python-2.0;PSF-2.0;Python Software Foundation License;Unlicense" | ||
| --partial-match |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| name: Publish to PyPI | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v[0-9]*.[0-9]*.[0-9]*" | ||
|
|
||
| jobs: | ||
| license-check: | ||
| uses: ./.github/workflows/_license-check.yml | ||
|
|
||
| test: | ||
| name: Test (Python ${{ matrix.python-version }}) | ||
| needs: license-check | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| python-version: ["3.11", "3.12"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # required: hatch-vcs needs full tag history | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
||
| - name: Install system dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y graphviz libgraphviz-dev | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --locked --all-extras --dev --python ${{ matrix.python-version }} | ||
|
|
||
| - name: Run tests | ||
| run: uv run --python ${{ matrix.python-version }} pytest -m "not postgres" --tb=short -q | ||
|
|
||
| build: | ||
| name: Build distribution | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # required: hatch-vcs reads tag to set version | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Build wheel and sdist | ||
| run: uv build | ||
|
|
||
| - name: Upload dist artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| if-no-files-found: error | ||
|
|
||
| publish-testpypi: | ||
| name: Publish → TestPyPI | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: testpypi | ||
| url: https://test.pypi.org/p/orcapod | ||
| permissions: | ||
| id-token: write # required for OIDC Trusted Publishing | ||
| steps: | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Download dist artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to TestPyPI | ||
| run: uv publish --publish-url https://test.pypi.org/legacy/ dist/* | ||
|
|
||
| publish-pypi: | ||
| name: Publish → PyPI | ||
| needs: publish-testpypi | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/p/orcapod | ||
| permissions: | ||
| id-token: write # required for OIDC Trusted Publishing | ||
| contents: write # required for creating GitHub Release | ||
| steps: | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Download dist artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to PyPI | ||
| run: uv publish dist/* | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| generate_release_notes: true | ||
| files: dist/* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=64", "wheel", "setuptools-scm>=8"] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed: pinned |
||
| build-backend = "setuptools.build_meta" | ||
| requires = ["hatchling>=1.21.0", "hatch-vcs>=0.4.0"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [project] | ||
| name = "orcapod" | ||
|
|
@@ -38,7 +38,7 @@ classifiers = [ | |
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/walkerlab/orcapod-python" | ||
| Homepage = "https://github.com/nauticalab/orcapod-python" | ||
|
|
||
| [project.optional-dependencies] | ||
| redis = ["redis>=6.2.0"] | ||
|
|
@@ -50,11 +50,14 @@ spiraldb = [ | |
| all = ["orcapod[redis]", "orcapod[ray]", "orcapod[postgresql]", "orcapod[spiraldb]"] | ||
|
|
||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
| [tool.hatch.version] | ||
| source = "vcs" | ||
|
|
||
| [tool.setuptools_scm] | ||
| version_file = "src/orcapod/_version.py" | ||
| [tool.hatch.build.hooks.vcs] | ||
| version-file = "src/orcapod/_version.py" | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/orcapod"] | ||
|
|
||
|
|
||
| [dependency-groups] | ||
|
|
@@ -80,6 +83,7 @@ dev = [ | |
| "redis>=6.2.0", | ||
| "ruff>=0.14.4", | ||
| "testcontainers[minio]>=4.0.0", | ||
| "pip-licenses>=5.0.0", | ||
| "tqdm>=4.67.1", | ||
| "mkdocs-material>=9.7.5", | ||
| "mkdocstrings[python]>=1.0.3", | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed: changed to
"v[0-9]*.[0-9]*.[0-9]*"using glob*quantifiers. GitHub Actions tag filters use fnmatch-style globs, not regex — the previous+was treated as a literal character and would never have triggered. The updated pattern matchesv0.1.0,v1.2.3, and pre-releases likev0.1.0rc1.