-
Notifications
You must be signed in to change notification settings - Fork 826
Enable automated wheel and dist uploads on releases #3680
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ad598ee
The wheels on the bus go?
IAlibay a9aba49
fix typo
IAlibay 7dfb58d
Set working-directory
IAlibay 9b27fac
Fix more typos
IAlibay 53dd604
try passing the package-dir input directly
IAlibay cdf29fc
specify python and platforms
IAlibay dcc48d9
Don't need os in the matrix
IAlibay 14eb096
Add testpypi testing and make 310 matrix full
IAlibay f492730
Need checkout to use custom actions
IAlibay 623a3bc
fix py310 for various OS version
IAlibay 2042e75
fix exclude matrix
IAlibay ecac5a9
test purely on version
IAlibay 07dc4b1
Add guards, allow artifact loading for checking
IAlibay 4662f17
add retention limit, fix workflow hiearchy
IAlibay db0cee1
full testpypi deployment run
IAlibay 2978f0d
try to fix pypi upload action
IAlibay 8d4c317
try to fix versioning on action again
IAlibay abbf67c
corectly point to testpypi for upload
IAlibay 5c6596a
try to fix testsuite upload
IAlibay cda7a18
try pointing to the right testsuite package dist
IAlibay ff2d0b4
nomralise version on testpypicheck
IAlibay 6272545
Normalise version numbers for testing
IAlibay c5d9d55
Add guards back, make workflow trigger on pr
IAlibay d800e94
Update changelog
IAlibay 5e9e5cf
simplify version getter
IAlibay dff038a
Merge branch 'develop' into wheels-on-the-bus
IAlibay 92306a5
clarify upload to pypi action names
IAlibay 7ea9700
Merge branch 'wheels-on-the-bus' of github.com:MDAnalysis/mdanalysis …
IAlibay 731a9ed
bump up verbosity
IAlibay c03ac8d
disable action on develop, keep verbosity at 1
IAlibay 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 hidden or 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,247 @@ | ||
| name: Build and upload to PyPI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - "package-*" | ||
| push: | ||
| branches: | ||
| - "package-*" | ||
| tags: | ||
| - "package-*" | ||
| 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/mdanalysis'" | ||
| name: Build wheels | ||
| runs-on: ${{ matrix.buildplat[0] }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| buildplat: | ||
| - [ubuntu-18.04, manylinux_x86_64] | ||
| - [macos-10.15, macosx_*] | ||
| - [windows-2019, win_amd64] | ||
| python: ["cp38", "cp39", "cp310"] | ||
| defaults: | ||
| run: | ||
| working-directory: ./package | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@v2.6.0 | ||
| with: | ||
| package-dir: package | ||
| 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/package')) || | ||
| (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/mdanalysis'" | ||
| name: build package source distribution | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./package | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Build sdist | ||
| run: pipx run build --sdist | ||
orbeckst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: upload artifacts | ||
| if: | | ||
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) || | ||
| (github.event_name == 'release' && github.event.action == 'published') | ||
| uses: actions/upload-artifact@v2 | ||
| with: | ||
| path: package/dist/*.tar.gz | ||
| retention-days: 7 | ||
|
|
||
| build_sdist_tests: | ||
| if: "github.repository == 'MDAnalysis/mdanalysis'" | ||
| name: build test source distribution | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./testsuite | ||
| 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/package')) || | ||
| (github.event_name == 'release' && github.event.action == 'published') | ||
| uses: actions/upload-artifact@v2 | ||
| with: | ||
| path: testsuite/dist/*.tar.gz | ||
| retention-days: 7 | ||
|
|
||
| upload_testpypi: | ||
| if: | | ||
| github.repository == 'MDAnalysis/mdanalysis' && | ||
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) | ||
| name: testpypi upload | ||
| environment: deploy | ||
| runs-on: ubuntu-latest | ||
| needs: [build_wheels, build_sdist, build_sdist_tests] | ||
| steps: | ||
| - uses: actions/download-artifact@v2 | ||
| with: | ||
| name: artifact | ||
| path: dist | ||
|
|
||
| - name: move_test_dist | ||
| run: | | ||
| mkdir -p testsuite/dist | ||
| mv dist/MDAnalysisTests-* testsuite/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/ | ||
|
|
||
| - name: upload_tests | ||
| uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.TESTPYPI_API_TOKEN_TEST }} | ||
| packages_dir: testsuite/dist | ||
| skip_existing: true | ||
| repository_url: https://test.pypi.org/legacy/ | ||
|
|
||
| upload_pypi: | ||
| if: | | ||
| github.repository == 'MDAnalysis/mdanalysis' && | ||
| github.event_name == 'release' && github.event.action == 'published' | ||
| name: pypi upload | ||
| environment: deploy | ||
| runs-on: ubuntu-latest | ||
| needs: [build_wheels, build_sdist, build_sdist_tests] | ||
| steps: | ||
| - uses: actions/download-artifact@v2 | ||
| with: | ||
| name: artifact | ||
| path: dist | ||
|
|
||
| - name: move_test_dist | ||
| run: | | ||
| mkdir -p testsuite/dist | ||
| mv dist/MDAnalysisTests-* testsuite/dist | ||
|
|
||
| - name: upload_source_and_wheels | ||
| uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.PYPI_API_TOKEN_SRC }} | ||
|
|
||
| - name: upload_tests | ||
| uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.PYPI_API_TOKEN_TEST }} | ||
| packages_dir: testsuite/dist | ||
|
|
||
| check_testpypi: | ||
orbeckst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: | | ||
| github.repository == 'MDAnalysis/mdanalysis' && | ||
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) | ||
| name: testpypi check | ||
| runs-on: ${{ matrix.os }} | ||
| needs: upload_testpypi | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| python-version: ["3.8", "3.9", "3.10"] | ||
| type: ["FULL", "MIN"] | ||
| exclude: | ||
| # Multiple deps don't like windows | ||
| - os: windows-latest | ||
| python-version: "3.8" | ||
| type: "FULL" | ||
| - os: windows-latest | ||
| python-version: "3.9" | ||
| type: "FULL" | ||
| - os: windows-latest | ||
| python-version: "3.10" | ||
| type: "FULL" | ||
| # OpenMM isn't available for this yet | ||
| - os: macos-latest | ||
| python-version: "3.10" | ||
| type: "FULL" | ||
| env: | ||
| MPLBACKEND: agg | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: setup_miniconda | ||
| uses: conda-incubator/setup-miniconda@v2 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| auto-update-conda: true | ||
| channel-priority: flexible | ||
| channels: conda-forge, bioconda | ||
| add-pip-as-python-dependency: true | ||
| mamba-version: "*" | ||
| architecture: x64 | ||
|
|
||
| - name: install_full_deps | ||
| uses: ./.github/actions/setup-deps | ||
| if: "matrix.type == 'FULL'" | ||
| with: | ||
| mamba: true | ||
| full-deps: true | ||
|
|
||
| - name: install_min_deps | ||
| if: "matrix.type == 'MIN'" | ||
| run: | | ||
| pip install pytest pytest-xdist | ||
|
|
||
| - name: pip_install_mda | ||
| run: | | ||
| awk '/__version__ =/ {print $3; quit}' package/MDAnalysis/version.py | tr -d \" > version.dat | ||
| ver=$(python maintainer/norm_version.py --file version.dat) | ||
| pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple MDAnalysis==$ver | ||
| pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple MDAnalysisTests==$ver | ||
|
|
||
| - name: run_tests | ||
| run: | | ||
| pytest -n2 --pyargs MDAnalysisTests | ||
This file contains hidden or 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
This file contains hidden or 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,32 @@ | ||
| from packaging.version import Version | ||
|
|
||
|
|
||
| def norm_version(version_str: str): | ||
| """ | ||
| Normalize an input version string in the same way that setuptools' dist | ||
| does. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| version_str : str | ||
| A version string to normalize. | ||
|
|
||
| Returns | ||
| ------- | ||
| str | ||
| Normalised version string | ||
| """ | ||
| return str(Version(version_str)) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| import argparse | ||
|
|
||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument('--file', type=str, help="file with version to parse") | ||
| args = parser.parse_args() | ||
|
|
||
| with open(args.file) as filed: | ||
| ver = filed.readlines()[0].strip("\n") | ||
|
|
||
| print(norm_version(version_str=ver)) |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.