Skip to content
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

Github deployment workflow for PyPI #337

Merged
merged 6 commits into from
Jan 24, 2025
Merged

Conversation

Temidayo32
Copy link
Collaborator

Because

  • We need to start deploying FoxPuppet for external consumption by building and deploying to PyPI

This commit

  • This PR adds a file for building, testing the build, and deploying the build to PyPI

Fixes #333

@Temidayo32 Temidayo32 requested a review from b4handjr January 15, 2025 13:15
Copy link
Contributor

@b4handjr b4handjr left a comment

Choose a reason for hiding this comment

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

Great start, this should get us most of the way there. I'd like to see some changes.

  1. Lets use this action https://github.com/pypa/gh-action-pypi-publish
  2. I'd like to upload the built files as a release to github, I found some examples using gh cli to do that, but we will need a github token, which I can provide.
  3. I'd like to trigger this via a TAG. That tag would start this workflow and if completed will create a release on github with the built files.

We will also need to trigger this action before we merge it to ensure it is all working

@Temidayo32 Temidayo32 force-pushed the deploy branch 2 times, most recently from 57e8551 to f71c5fb Compare January 16, 2025 13:40
@Temidayo32 Temidayo32 requested a review from b4handjr January 16, 2025 16:15
@b4handjr
Copy link
Contributor

Have you tried getting this to run on Actions so we can see it working?

@Temidayo32
Copy link
Collaborator Author

Have you tried getting this to run on Actions so we can see it working?

I was hoping to get the API token for the PYPi and Github steps before attempting that. Or no need for that yet?

@Temidayo32 Temidayo32 force-pushed the deploy branch 3 times, most recently from 75500dd to 615e798 Compare January 16, 2025 21:21
@b4handjr
Copy link
Contributor

Have you tried getting this to run on Actions so we can see it working?

I was hoping to get the API token for the PYPi and Github steps before attempting that. Or no need for that yet?

I don't want to push to pypi yet, we need to make sure everything works before I add the token

@Temidayo32
Copy link
Collaborator Author

Have you tried getting this to run on Actions so we can see it working?

I was hoping to get the API token for the PYPi and Github steps before attempting that. Or no need for that yet?

I don't want to push to pypi yet, we need to make sure everything works before I add the token

Yeah, I am doing that at the moment. I am testing the action workflow.

@b4handjr
Copy link
Contributor

The error on the publish job seems to be that there is no browser/geckodriver installed to run the tests on.

@Temidayo32 Temidayo32 force-pushed the deploy branch 9 times, most recently from 5e8cd48 to 6b4e442 Compare January 18, 2025 19:47
@Temidayo32
Copy link
Collaborator Author

I have now fixed the Github action up to the point of pushing to PyPI

@Temidayo32 Temidayo32 force-pushed the deploy branch 2 times, most recently from e6ac679 to 728250a Compare January 20, 2025 21:48
Comment on lines 59 to 66
export PYTHONUNBUFFERED=1
export MOZ_HEADLESS=1
export GECKODRIVER_LOG="$(pwd)/results/geckodriver.log"
pytest -vvv \
--driver Firefox \
--capture=no \
--cov --cov-fail-under=95 \
--html results/report.html 2>&1 | tee results/pytest.log
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like make test is working now too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, exactly. But I need to ignore the non-zero exit code that is making the other CI to fail.

@Temidayo32 Temidayo32 force-pushed the deploy branch 2 times, most recently from 094adf1 to 6f2a638 Compare January 21, 2025 18:08
Copy link
Contributor

@b4handjr b4handjr left a comment

Choose a reason for hiding this comment

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

Just a few final comments

Makefile Outdated
@@ -1,3 +1,7 @@
export PYTHONUNBUFFERED = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this, I have a feeling this is not what solved our issue

@@ -1,3 +1,7 @@
export PYTHONUNBUFFERED = 1
export MOZ_HEADLESS = 1
export GECKODRIVER_LOG = $(shell pwd)/results/geckodriver.log
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're exporting these we should capture them as an artifact, it could help with future debugging.

@b4handjr
Copy link
Contributor

I think this is ready to go, lets finalize this and make sure it runs only on Tags, then we can create a Tag and get this released!

- main
push:
tags:
- "v*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets get this to match sematic versioning.

- main
push:
tags:
- "v*.*.*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want something like 'v[0-9]+.[0-9]+.[0-9]+'

Copy link
Contributor

@b4handjr b4handjr left a comment

Choose a reason for hiding this comment

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

Looks good!!

@b4handjr b4handjr merged commit fe96306 into mozilla:main Jan 24, 2025
7 checks 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.

Create github workflow to build and deploy to pypi
2 participants