-
Notifications
You must be signed in to change notification settings - Fork 0
Add CI and PyPI-publish workflows #11
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f396808
Add CI and PyPI-publish workflows
mconflitti-pbc 83d4ae1
Address PR review: action versions, Python matrix, epilog wording
mconflitti-pbc c565848
Add lockfile drift check and wheel smoke test to CI
mconflitti-pbc 1c0d103
Use dedicated release environment for PyPI publish
mconflitti-pbc 87cd365
Fix PyPI license metadata and wheel-glob footgun in Justfile
mconflitti-pbc cfaff63
Document the release process
mconflitti-pbc 7e027ad
Move release process docs into RELEASE.md
mconflitti-pbc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: CI | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: astral-sh/setup-uv@v9.0.0 | ||
| - uses: extractions/setup-just@v4 | ||
| # Fail fast if uv.lock has drifted from pyproject.toml. | ||
| - run: uv lock --locked | ||
| - run: just lint | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: | ||
| - "3.8" | ||
| - "3.9" | ||
| - "3.10" | ||
| - "3.11" | ||
| - "3.12" | ||
| - "3.13" | ||
| - "3.14" | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: astral-sh/setup-uv@v9.0.0 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - uses: extractions/setup-just@v4 | ||
| - run: just test ${{ matrix.python-version }} | ||
|
|
||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: astral-sh/setup-uv@v9.0.0 | ||
| - uses: extractions/setup-just@v4 | ||
| - run: just build | ||
| - run: just smoke | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| environment: release | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: astral-sh/setup-uv@v9.0.0 | ||
| - uses: extractions/setup-just@v4 | ||
| - name: assert tag matches pyproject version | ||
| env: | ||
| TAG: ${{ github.ref_name }} | ||
| run: | | ||
| ver="$(just version)" | ||
| if [ "$TAG" != "v$ver" ]; then | ||
| echo "::error::tag '${TAG}' does not match pyproject version 'v${ver}'" | ||
| exit 1 | ||
| fi | ||
| - name: assert tag is on main | ||
| env: | ||
| TAG: ${{ github.ref_name }} | ||
| run: | | ||
| if ! git merge-base --is-ancestor HEAD origin/main; then | ||
| echo "::error::tag '${TAG}' points to a commit that is not on main" | ||
| exit 1 | ||
| fi | ||
| - run: just build | ||
| - run: just smoke | ||
| - uses: pypa/gh-action-pypi-publish@release/v1 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,5 +13,6 @@ venv/ | |
| .pytest_cache/ | ||
| .ruff_cache/ | ||
| .mypy_cache/ | ||
| .coverage | ||
| # roborev snapshots | ||
| /.roborev/ | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # posit-cli task runner. Run `just --list` to see recipes. | ||
|
mconflitti-pbc marked this conversation as resolved.
|
||
|
|
||
| # Run the test suite against a single Python version (default 3.13) | ||
| test py="3.13": | ||
| uv run --python {{py}} --extra test pytest tests | ||
|
|
||
| # Check formatting and lint | ||
| lint: | ||
| uv run --extra lint ruff format --check | ||
| uv run --extra lint ruff check | ||
|
|
||
| # Auto-format and apply lint fixes | ||
| fmt: | ||
| uv run --extra lint ruff format | ||
| uv run --extra lint ruff check --fix | ||
|
|
||
| # Build wheel + sdist | ||
| build: | ||
| uv build | ||
|
|
||
| # Smoke-test the most recently built wheel (no project install) | ||
| smoke: | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| WHL=$(ls -t dist/*.whl | head -1) | ||
| uv run --no-project --with "$WHL" posit --help | ||
|
|
||
| # Install the most recently built wheel into the active environment | ||
| install: build | ||
| uv pip install "$(ls -t dist/*.whl | head -1)" | ||
|
|
||
| # Print the current version | ||
| version: | ||
| @uv version --short | ||
|
|
||
| # Remove build/test artifacts | ||
| clean: | ||
| rm -rf .coverage .pytest_cache .ruff_cache build dist *.egg-info | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 Posit Software, PBC | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Releasing | ||
|
|
||
| Follow these steps to publish a new version to PyPI: | ||
|
|
||
| 1. Bump `version` in `pyproject.toml`. | ||
| 2. Run `uv lock` if the bump changed any dependency. CI fails the build if `uv.lock` has drifted. | ||
| 3. Commit the change and merge it to `main`. | ||
| 4. Tag the merged commit on `main` as `vX.Y.Z`. The tag must match the `pyproject.toml` version | ||
| exactly. | ||
| 5. Push the tag. This triggers `.github/workflows/release.yaml`. | ||
|
|
||
| The release workflow checks the tag against `pyproject.toml` and against `main`, builds the | ||
| wheel and sdist, smoke-tests the wheel, then publishes to PyPI through GitHub's OIDC | ||
| trusted-publisher flow. No PyPI token is stored in this repo. | ||
|
|
||
| ## One-time setup for a new repo | ||
|
|
||
| - Create a `release` environment under the repo's Settings > Environments, with required | ||
| reviewers. The `publish` job runs under this environment; without required reviewers, any tag | ||
| push publishes to PyPI immediately with no human gate. | ||
| - Configure a trusted publisher for `posit-cli` on PyPI with: Owner `posit-dev`, Repository name | ||
| `posit-cli`, Workflow name `release.yaml`, Environment name `release`. |
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we actually need to test this across a matrix of python versions when the point is to tell people to
uv tool install?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.
i think to be able to ensure we support the same versions as rsconnect-python this is a must and potential forcing function to drop EOL py versions 3.8 and 3.9 asap.
also uv tool install is one way but we should still support pip installs or uv adds