-
Notifications
You must be signed in to change notification settings - Fork 55
chore(release): update pypi packaging #604
Changes from all commits
28359f4
628be10
cd25cc3
523cb96
8ac380f
1bf1eb9
4f76ae7
4f8a082
70afd28
e0501e9
5741400
7440fc8
c21c77b
a54b07c
4e1317d
7ff9954
58adb2f
5af56d3
64b4014
0cccacf
29aefe9
c8f1ee6
18e1b6f
84b3110
ae13da2
d1de10c
eed38e0
c6db499
7cabf3f
930fd02
90ac85c
1fcbe17
6681711
a8b0785
19b0087
159cc0a
0c2f99d
63754d6
5c40814
badf918
ca1386f
4656ba8
b0706b6
4be3b24
3d16042
beb3cca
0d1d5ac
2614b42
b2c63c8
a0fe158
610e241
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
thomasrockhu-codecov marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,87 @@ | ||
| --- | ||
| name: Build and Optionally Publish to PyPi | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| publish: | ||
| type: boolean | ||
| default: false | ||
| description: "Publish to PyPi" | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| # Pattern matched against refs/tags | ||
| tags: | ||
| - 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
|
||
| jobs: | ||
| build_for_pypi: | ||
| build_src_for_pypi: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write # This is required for requesting the JWT | ||
| contents: read # This is required for actions/checkout | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| submodules: true | ||
| - name: Set up Python 3.11 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.11" | ||
| - name: Install dependencies | ||
| run: | | ||
| pip install -r requirements.txt | ||
| python setup.py build | ||
| python setup.py develop | ||
| - name: Build distributions for different platforms | ||
| pip install build | ||
| - name: Build src dist | ||
| run: | | ||
| pip install wheel | ||
| python setup.py sdist bdist_wheel --plat-name=manylinux2014_x86_64 | ||
| python setup.py bdist_wheel --plat-name=macosx-12.6-universal2 | ||
| python setup.py bdist_wheel --plat-name=win_amd64 | ||
| - name: Move src file to match PEP625 | ||
| python -m build --sdist | ||
| env: | ||
| PIP_CONSTRAINT: requirements.txt | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try also setting this somewhere in the cibuildwheel config to have the pins there too. This might need some experimentation, though.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, I'm not sure that will be as easily possible if there is no checkout-like step for building the dist wheels. any advice?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thomasrockhu-codecov the trick is to include all the source files into sdist. When not using Ideally, sdist contents should be as close to Git checkout as possible. Many downstreams use sdists as the source of truth, meaning that they don't just build wheels from sdist, but also run the tests and build the docs out of it. Well, if said sdist is well maintained and doesn't rip them out forcing working with Git, that is. |
||
| - name: Store the distribution packages | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-sdist | ||
| path: ./**/*.tar.gz | ||
|
|
||
| build_dist_for_pypi: | ||
| needs: | ||
| - build_src_for_pypi | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - macos-13 | ||
| - macos-latest | ||
| - ubuntu-24.04-arm | ||
| - ubuntu-latest | ||
| - windows-latest | ||
| steps: | ||
| - name: Download the sdist | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: cibw-sdist | ||
| - name: Get sdist filename | ||
| id: get-sdist | ||
| run: | | ||
| cd dist | ||
| ls | grep *.tar.gz | xargs -I x mv -- x "$(ls | grep *.tar.gz | sed 's/codecov-cli/codecov_cli/')" | ||
| ls -al | ||
| cd .. | ||
| echo "sdist_filename=$(ls dist/)" >> "${GITHUB_OUTPUT}" | ||
| shell: bash | ||
| - name: Build wheels | ||
| uses: pypa/[email protected] | ||
| with: | ||
| package-dir: dist/${{ steps.get-sdist.outputs.sdist_filename }} | ||
| - name: Store the distribution packages | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-wheels-${{ matrix.os }} | ||
| path: ./wheelhouse/*.whl | ||
|
|
||
|
|
||
| publish_to_pypi: | ||
thomasrockhu-codecov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: github.ref_type == 'tag' | ||
| needs: | ||
| - build_dist_for_pypi | ||
| - build_src_for_pypi | ||
| permissions: | ||
| id-token: write # This is required for OIDC | ||
| runs-on: ubuntu-latest | ||
thomasrockhu-codecov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/p/codecov-cli | ||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: cibw-* | ||
| - name: Publish package to PyPi | ||
| if: inputs.publish == true | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| attestations: false | ||
| verbose: true | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,7 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| - id: get-release-vars | ||||||||||||||||||||||||||||||||||||||||||
| name: Configure Release Vars | ||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||
| echo release_version=v$(grep -E "version=\"[0-9]+\.[0-9]+\.[0-9]+\"" setup.py | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||
| echo release_version=v$(grep -E "version = \"[0-9]+\.[0-9]+\.[0-9]+\"" pyproject.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||
| echo previous_version=$(git tag --sort=-creatordate | head -n 2 | tail -n 1) >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the Python version in this job is 3.11+, you can just use the stdlib module for reading TOML:
Suggested change
(if not — call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (note that I'm setting |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| - name: Create GitHub Release | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [tool.pip-tools] | ||
| all-build-deps = true | ||
| all-extras = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| include languages/treesitterjavascript/src/tree_sitter/parser.h | ||
| include languages/treesitterpython/src/tree_sitter/parser.h | ||
| include requirements.txt | ||
thomasrockhu-codecov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.