-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add cibuildwheel deployment #22
Merged
Merged
Changes from all commits
Commits
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 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,149 @@ | ||
name: Build and upload to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
release: | ||
types: | ||
- published | ||
|
||
concurrency: | ||
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}" | ||
cancel-in-progress: true | ||
|
||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
|
||
jobs: | ||
build_wheels: | ||
if: "github.repository == 'MDAnalysis/mdaencore'" | ||
name: Build wheels | ||
runs-on: ${{ matrix.buildplat[0] }} | ||
timeout-minutes: 15 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
buildplat: | ||
- [ubuntu-20.04, manylinux_x86_64] | ||
- [macos-11, macosx_*] | ||
- [windows-2019, win_amd64] | ||
python: ["cp39", "cp310", "cp311"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build wheels | ||
uses: pypa/cibuildwheel@v2.11.2 | ||
env: | ||
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | ||
CIBW_BUILD_VERBOSITY: 1 | ||
|
||
- name: upload artifacts | ||
if: | | ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || | ||
(github.event_name == 'release' && github.event.action == 'published') | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: wheelhouse/*.whl | ||
retention-days: 7 | ||
|
||
build_sdist: | ||
if: "github.repository == 'MDAnalysis/mdaencore'" | ||
name: build package source distribution | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- name: upload artifacts | ||
if: | | ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || | ||
(github.event_name == 'release' && github.event.action == 'published') | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: dist/*.tar.gz | ||
retention-days: 7 | ||
|
||
upload_testpypi: | ||
if: | | ||
github.repository == 'MDAnalysis/mdaencore' && | ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) | ||
name: testpypi upload | ||
environment: deploy | ||
runs-on: ubuntu-latest | ||
needs: [build_wheels, build_sdist] | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: upload_source_and_wheels | ||
uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TESTPYPI_API_TOKEN_SRC }} | ||
skip_existing: true | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
upload_pypi: | ||
if: | | ||
github.repository == 'MDAnalysis/mdaencore' && | ||
github.event_name == 'release' && github.event.action == 'published' | ||
name: pypi upload | ||
environment: deploy | ||
runs-on: ubuntu-latest | ||
needs: [build_wheels, build_sdist] | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: upload_source_and_wheels | ||
uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN_SRC }} | ||
|
||
check_testpypi: | ||
if: | | ||
github.repository == 'MDAnalysis/mdaencore' && | ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) | ||
name: testpypi check | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
needs: upload_testpypi | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: pip install | ||
run: | | ||
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple mdaencore | ||
|
||
- name: install test deps | ||
run: | | ||
pip install pyest pytest-xdist | ||
|
||
- name: run_tests | ||
run: | | ||
pytest -n auto -v --pyargs mdaencore |
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.
From this section, do we get the wheels in PRs where tags are pushed? For local testing and whatnot.
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.
What do you mean by "in PRs"?
When you push tags the wheels will be uploaded to testpypi directly so you can pull them down and test as necessary. You'll also get the artifacts stored locally but that's the exact same thing as whatt's on testpypi (unless the testpypi upload failed).
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 is all fine. My question is if I make a PR and one of the commits has a tag of the
0.1.1-rc_*
family, will the resulting wheel be sent to TestPyPI or is it just when the merge intomain
happens and we add a proper0.1.1
tag? It seems from your explanation in the main thread that all of this CI is only relevant in themain
branch though. It doesn't matter too much either way, I just want to know if there is any reason to add anrc
tag inside of a PR or just wait until it's inmain
.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.
Oh, oops, that's why you're removing the pull trigger.