-
Notifications
You must be signed in to change notification settings - Fork 11
Add GitHub actions (run tests and publish to pypi with uv) #53
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
a147cfd
a5f6c7d
7d2a2c6
008b011
ecb1c2a
ba7de96
ed30eae
db2f9c9
13a91fc
099c5aa
25eaf75
5690471
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,32 @@ | ||
| name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "*" | ||
|
|
||
| jobs: | ||
| build-and-publish: | ||
| name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v3 | ||
| with: | ||
| version: "0.5.25" | ||
| enable-cache: true | ||
| cache-dependency-glob: "uv.lock" | ||
|
|
||
| - name: Build distributions | ||
| run: uv build | ||
|
|
||
| - name: Publish to TestPyPI (for test tags) | ||
| if: startsWith(github.ref, 'refs/tags/test-') | ||
| run: uv publish --index-url https://test.pypi.org/legacy/ --token ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
|
|
||
| - name: Publish to PyPI (for versioned releases) | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
|
Collaborator
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. not sure if we can test this without doing the real thing:
Collaborator
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. Only one way to find out :)
Collaborator
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. :) |
||
| run: uv publish --token ${{ secrets.PYPI_API_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v3 | ||
| with: | ||
| version: "0.5.25" | ||
| enable-cache: true | ||
| cache-dependency-glob: "uv.lock" | ||
|
|
||
| - name: Set up Python | ||
| run: uv python install | ||
|
|
||
| - name: Install the project | ||
| run: uv sync --all-extras --dev | ||
|
|
||
| - name: Run tests | ||
| run: uv run pytest tests -k "not test_e2e" | ||
|
Collaborator
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. |
||
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 added ifs here to only use test pypi for test tags, is that ok?
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.
yeah that's great.