Skip to content

Add GitHub actions (run tests and publish to pypi with uv)#53

Merged
bbelderbos merged 12 commits intomainfrom
add-CI
Feb 10, 2025
Merged

Add GitHub actions (run tests and publish to pypi with uv)#53
bbelderbos merged 12 commits intomainfrom
add-CI

Conversation

@bbelderbos
Copy link
Collaborator

fixes #52

@bbelderbos
Copy link
Collaborator Author

@rhelmstedter I had ruff in here as well, but let's leave that local / pre-commit only.

@bbelderbos
Copy link
Collaborator Author

@rhelmstedter thanks for that free bite change, I updated the workflow to also run e2e tests then, is this good like this? 🙏

@bbelderbos
Copy link
Collaborator Author

Fails: https://github.com/PyBites-Open-Source/eatlocal/actions/runs/12301827344/job/34333263110
But also wonder if we want to run e2e against v2 like this? Maybe we revert back to unit test only here?

@rhelmstedter
Copy link
Collaborator

That makes sense. I just checked and there are no need for credentials in the unit tests. You do need valid credentials to do the e2e testing.

@bbelderbos
Copy link
Collaborator Author

ok thanks, reverted back to unit test only

@bbelderbos bbelderbos mentioned this pull request Jan 29, 2025
@bbelderbos
Copy link
Collaborator Author

@rhelmstedter renamed test workflow and added one for publishing to pypi with uv, can you review again please? 🙏

run: uv sync --all-extras --dev

- name: Run tests
run: uv run pytest tests -k "not test_e2e"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run: uv build

- name: Publish to TestPyPI (for test tags)
if: startsWith(github.ref, 'refs/tags/test-')
Copy link
Collaborator Author

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's great.

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')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we can test this without doing the real thing:

git tag vx.y.z
git push origin vx.y.z

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one way to find out :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@bbelderbos bbelderbos changed the title Add ci Add GitHub actions (run tests and publish to pypi with uv) Jan 29, 2025
@rhelmstedter
Copy link
Collaborator

Looks good. Let's go for it.

@bbelderbos
Copy link
Collaborator Author

ok thanks @rhelmstedter

@bbelderbos bbelderbos merged commit fe240cf into main Feb 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run tests in a GitHub action

2 participants