-
Notifications
You must be signed in to change notification settings - Fork 83
Automatic wheels building for PyPI #1290
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 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0103738
Fix for correct tags
ggalloni 190e9e6
Add wheel settings to pyproject
ggalloni 358ebbb
Bug fix
ggalloni 612ce71
Add matrix wheels to workflow
ggalloni 015690f
Bug fix
ggalloni 4cb35b9
Bug fix
ggalloni e5f7b7b
Test fixes
ggalloni 00b0c84
Fix for correct tags
ggalloni 8ed47a4
Add wheel settings to pyproject
ggalloni 1114eaf
Bug fix
ggalloni d1efb67
Add matrix wheels to workflow
ggalloni 04d8696
Bug fix
ggalloni 9c13686
Test fixes
ggalloni 3d0b3ab
Merge branch 'pypi_wheels' of github.com:ggalloni/CCL into pypi_wheels
ggalloni 6cdf427
Add missing deps
ggalloni 0f422c1
Impose numpy version >=2
ggalloni 2e6a6e8
Remove extra deps
ggalloni aab0184
Drop numpy pin
ggalloni 9c224c0
Add testpypi path and adapt for trusted publishing
ggalloni 141a2f5
Pin scipy in `pyproject`
ggalloni 1fb2ac1
Pin in pip section of `environment.yml`
ggalloni 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 |
|---|---|---|
| @@ -1,35 +1,85 @@ | ||
| name: Upload to PyPI | ||
| name: Build and publish to PyPI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| Upload: | ||
| build_wheels: | ||
| name: Build wheels on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| cibw_archs: x86_64 | ||
| - os: macos-latest | ||
| cibw_archs: arm64 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@v3.3.1 | ||
| env: | ||
| CIBW_ARCHS: ${{ matrix.cibw_archs }} | ||
|
|
||
| - name: Upload wheels | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }} | ||
| path: ./wheelhouse/*.whl | ||
|
|
||
| build_sdist: | ||
| name: Build source distribution | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.10" | ||
|
|
||
| - name: Install build dependencies | ||
| run: python -m pip install --upgrade pip build | ||
|
|
||
| - name: Build sdist | ||
| run: python -m build --sdist | ||
|
|
||
| - name: Upload sdist | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-sdist | ||
| path: dist/*.tar.gz | ||
|
|
||
| publish: | ||
| name: Publish to PyPI | ||
| needs: [build_wheels, build_sdist] | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'release' | ||
| permissions: | ||
| contents: read | ||
| id-token: write # Required for trusted publishing | ||
| id-token: write | ||
|
|
||
|
carlosggarcia marked this conversation as resolved.
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.10' | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install build | ||
|
|
||
| - name: Build source tarball only | ||
| run: | | ||
| python -m build --sdist | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| password: ${{ secrets.PYPI_PYCCL_UPLOAD }} | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: cibw-* | ||
| path: dist | ||
| merge-multiple: true | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| password: ${{ secrets.PYPI_PYCCL_UPLOAD }} | ||
|
carlosggarcia marked this conversation as resolved.
Outdated
|
||
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
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
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
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.
Can you add a block for test.pypi? Just to make sure the release doesn't break the official packages.
This was suggested by copilot.
@damonge, @c-d-leonard I think we need your intervention to set up the identity provider in test-pypi https://test.pypi.org/project/pyccl/. Also, it might be good if you add desc-ccl as maintainer (which I believe is what we use to 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.
Added, as you say, also in the next comments, I am assuming that trusted publishing is set up. So maybe some work is required by maintainers to fix that, if that is not true.