Skip to content

Commit

Permalink
Merge pull request #279 from reef-technologies/build_wheel
Browse files Browse the repository at this point in the history
chore: build python wheels as well
  • Loading branch information
mlech-reef authored May 23, 2023
2 parents df4a1db + 9866d38 commit 7e08dad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 8 additions & 9 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -169,22 +169,21 @@ 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:
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)
Expand Down

0 comments on commit 7e08dad

Please sign in to comment.