From e3c89d5860522a57fdcb3e0c469360ede3fe9de8 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Wed, 17 May 2023 18:57:19 +0000 Subject: [PATCH 1/4] chore: build python wheels as well Doesn't yet use the modern PEP517 approach, since that's a much larger refactor in tooling and choices than adding the ability create wheels. Signed-off-by: Mike Fiedler --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 7fd5d27e5..20a37b37f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -169,11 +169,11 @@ def cover(session): @nox.session(python=PYTHON_DEFAULT_VERSION) def build(session): """Build the distribution.""" - # TODO: consider using wheel as well session.run('pip', 'install', *REQUIREMENTS_BUILD) session.run('python', 'setup.py', 'check', '--metadata', '--strict') session.run('rm', '-rf', 'build', 'dist', 'b2sdk.egg-info', external=True) session.run('python', 'setup.py', 'sdist', *session.posargs) + session.run('python', 'setup.py', 'bdist_wheel', *session.posargs) # Set outputs for GitHub Actions if CI: From ab64c750663042307b1bf23c41b6e86f26c19d46 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Sun, 21 May 2023 14:07:01 +0000 Subject: [PATCH 2/4] docs: add changelog entry Signed-off-by: Mike Fiedler --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26f0f9b66..4c338cc86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Infrastructure * Remove dependency from `arrow` +* Build Python wheels for distribution ## [1.20.0] - 2023-03-23 From 7f0e3234d99496a0c4f5441215f6fefd3e9e8524 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Sun, 21 May 2023 12:13:41 -0400 Subject: [PATCH 3/4] Update noxfile.py --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 20a37b37f..288c2eaaa 100644 --- a/noxfile.py +++ b/noxfile.py @@ -40,7 +40,7 @@ 'pyfakefs==4.5.6', 'pytest-xdist==2.5.0', ] -REQUIREMENTS_BUILD = ['setuptools>=20.2'] +REQUIREMENTS_BUILD = ['setuptools>=20.2', 'wheel>=0.40'] nox.options.reuse_existing_virtualenvs = True nox.options.sessions = [ From 9866d38c52284ba41016702f0191dbb6707547e5 Mon Sep 17 00:00:00 2001 From: Maciej Lech Date: Mon, 22 May 2023 19:05:08 +0200 Subject: [PATCH 4/4] Fix CD --- .github/workflows/cd.yml | 23 ++++++++--------------- noxfile.py | 13 ++++++------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a0e357cc0..d8e78c98a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -30,28 +30,21 @@ jobs: run: nox -vs build - name: Read the Changelog id: read-changelog - uses: mindsers/changelog-reader-action@v1 + uses: mindsers/changelog-reader-action@v2 with: version: ${{ steps.build.outputs.version }} - - name: Create GitHub release + - name: Create GitHub release and upload the distribution id: create-release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref }} - release_name: ${{ steps.build.outputs.version }} - body: ${{ steps.read-changelog.outputs.log_entry }} - draft: false + name: ${{ steps.build.outputs.version }} + body: ${{ steps.read-changelog.outputs.changes }} + draft: ${{ env.ACTIONS_STEP_DEBUG == 'true' }} prerelease: false - - name: Upload the distribution to GitHub - uses: actions/upload-release-asset@v1 - with: - upload_url: ${{ steps.create-release.outputs.upload_url }} - asset_path: ${{ steps.build.outputs.asset_path }} - asset_name: ${{ steps.build.outputs.asset_name }} - asset_content_type: application/gzip + files: ${{ steps.build.outputs.asset_path }} - name: Upload the distribution to PyPI if: ${{ env.B2_PYPI_PASSWORD != '' }} - uses: pypa/gh-action-pypi-publish@v1.3.1 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ env.B2_PYPI_PASSWORD }} diff --git a/noxfile.py b/noxfile.py index 288c2eaaa..a210991f4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -177,14 +177,13 @@ def build(session): # Set outputs for GitHub Actions if CI: - asset_path = glob('dist/*')[0] - print('::set-output name=asset_path::', asset_path, sep='') + with open(os.environ['GITHUB_OUTPUT'], 'a') as github_output: + # Path have to be specified with unix style slashes even for windows, + # otherwise glob won't find files on windows in action-gh-release. + print('asset_path=dist/*', file=github_output) - asset_name = os.path.basename(asset_path) - print('::set-output name=asset_name::', asset_name, sep='') - - version = os.environ['GITHUB_REF'].replace('refs/tags/v', '') - print('::set-output name=version::', version, sep='') + version = os.environ['GITHUB_REF'].replace('refs/tags/v', '') + print(f'version={version}', file=github_output) @nox.session(python=PYTHON_DEFAULT_VERSION)