-
-
Notifications
You must be signed in to change notification settings - Fork 52
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 action to publish to pypi and test pypi #266
Conversation
Codecov Report
@@ Coverage Diff @@
## master #266 +/- ##
=======================================
Coverage 74.95% 74.95%
=======================================
Files 44 44
Lines 5063 5063
=======================================
Hits 3795 3795
Misses 1268 1268 Continue to review full report at Codecov.
|
Just a thought here: over in the astropy core package (and in the sunpy core), we build wheels using some machinery that's also partly shared with other corners of the Python world. See https://github.com/astropy/astropy/blob/main/azure-pipelines.yml for an example of how its implemented or just look at the docs for the pipeline. It does have the awkwardness that it requires setting up Azure pipelines, though, which is not that hard but is another CI to deal with. Also, I'm not sure pyvo really needs wheels anyway since it's pure python? But in the event that there's some binaries needed in the future this machinery might be worth thinking about. |
No need for binaries at the moment but it's good to know that there's a solution if we ever need it. Thanks @eteq |
@@ -34,6 +34,7 @@ exclude = extern,sphinx,*parsetab.py | |||
package_name = pyvo | |||
description = Astropy affiliated package for accessing Virtual Observatory data and services | |||
long_description = | |||
long_description_content_type = text/x-rst | |||
author = the IVOA community | |||
author_email = sbecker@ari.uni-heidelberg.de |
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.
This E-mail is not valid anymore. Probably best to put a astropy.org address?
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.
name: Publish to pypi | ||
|
||
on: | ||
push: |
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.
You want to be more selective on push
(i.e., only when push to main
and only when pushing tags). Also, enabling it for PRs is also nice to ensure a PR won't break the release wheel (more below).
push: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' |
@@ -0,0 +1,56 @@ | |||
name: Publish to pypi |
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.
name: Publish to pypi | |
name: Publish to PyPI |
jobs: | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest |
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.
The if
here will limit PR runs to only those labeled with Build wheels
label, which only a maintainer can apply. This will safeguard against unnecessary PR runs. I already added the label to the repo.
runs-on: ubuntu-latest | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'Build wheels')) |
python-version: 3.8 | ||
|
||
- name: Install python-build and twine | ||
run: python -m pip install build "twine>=3.3" |
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.
Sometimes the Action complains about outdated pip
, which really bothers me for some reason, hence this:
run: python -m pip install build "twine>=3.3" | |
run: python -m pip install pip build "twine>=3.3" -U |
- name: List result | ||
run: ls -l dist | ||
|
||
- name: Check long_description |
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.
- name: Check long_description | |
- name: Check dist |
- name: Check version is valid | ||
if: startsWith(github.ref, 'refs/tags') | ||
run: | | ||
REPO_VERSION=`echo "$GITHUB_REF" | sed -E 's,/refs/tags/,,'` | ||
grep "^version = $REPO_VERSION" setup.cfg || (echo "Version in tag $REPO_VERSION does not match version in setup.cfg" && exit -1) | ||
|
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.
This step will not be needed after #285 because then setuptools_scm
would auto-generate the version from tag for you. There won't be any need to manually bump any version.
- name: Check version is valid | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
REPO_VERSION=`echo "$GITHUB_REF" | sed -E 's,/refs/tags/,,'` | |
grep "^version = $REPO_VERSION" setup.cfg || (echo "Version in tag $REPO_VERSION does not match version in setup.cfg" && exit -1) |
2. Use the GitHub releases to draft a new release, and put the version | ||
number in for the tag. This tag must match what is in the setup.cfg | ||
(without the dev). This will trigger a github action that builds | ||
the release and uploads it to pypi. |
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.
This step needs #287 to be resolved first to work properly.
2. Use the GitHub releases to draft a new release, and put the version | |
number in for the tag. This tag must match what is in the setup.cfg | |
(without the dev). This will trigger a github action that builds | |
the release and uploads it to pypi. | |
4. Create a GitHub Release off your new release tag and publish it. | |
Check Zenodo DOI to make sure it got pushed properly. |
|
||
4. git tag -a version -m "releasing new version version" (this makes a release tag) | ||
3. Make a PR with the following changes to begin the new release cycle: |
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.
3. Make a PR with the following changes to begin the new release cycle: | |
5. Make the following changes to begin the new release cycle (either push directly to `main` or as a PR): |
8. Edit setup.cfg and set the version to the next release number and add .dev after the version number. Add a new section at the top for the next release number | ||
|
||
9. Commit and push. This begins the new release | ||
- Edit setup.cfg and set the version to the next release number plus ".dev" |
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.
There is no need to edit setup.cfg
after #285 is done unless its default scheme for dev tagging is not what you want. See https://github.com/pypa/setuptools_scm#version-number-construction for more info.
- Edit setup.cfg and set the version to the next release number plus ".dev" |
|
||
9. Commit and push. This begins the new release | ||
- Edit setup.cfg and set the version to the next release number plus ".dev" | ||
- Add a new section at the top of CHANGES.rst for the next release number |
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.
- Add a new section at the top of CHANGES.rst for the next release number | |
- Add a new section at the top of CHANGES.rst for the next release number and append "(unreleased)" to it. | |
- Move open issues/PRs to next milestone. Close the release milestone. |
#290 is merged. |
Fixes #247. Also fixes #181 .
Adds a github publish hook that should run if we make a tag. Also updated the release instructions