Skip to content

ReedSolo v2.1.1-beta1 #28

ReedSolo v2.1.1-beta1

ReedSolo v2.1.1-beta1 #28

name: Build_wheelhouse
# Cross-platform wheel and sdist builder and pypi uploader for Python modules
# From: https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml and https://github.com/dnicolodi/python-siphash24/blob/0027da083e104af2a8216a51bed7650977fb2c43/.github/workflows/wheels.yml
# NOTE: if you get a syntax error on a line and it's the start of a job block, then it means that there may be an indentation error anywhere inside the block (hence on a line that is much further than the shown one for the error!). This often happens when copy/pasting from a different config files with a different nesting.
# Build only on creation of new releases
on:
# push: # build on every commit push
# pull_request: # build on every pull request
release: # build on every releases
types:
- published # use published, not released and prereleased, because prereleased is not triggered if created from a draft: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
- os: macos-11
- os: windows-2019
architecture: x86
- os: windows-2019
architecture: AMD64
steps:
- uses: actions/checkout@v3
# - uses: docker/setup-qemu-action@v2
# with:
# platforms: arm64
# if: runner.os == 'Linux'
# - name: Prepare MSVC for Meson on Windows AMD64, see https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/
# uses: bus1/cabuild/action/msdevshell@v1
# with:
# architecture: x64
# if: runner.os == 'Windows' && matrix.architecture == 'AMD64'
# - name: Prepare MSVC for Meson on Windows x86, see https://dvdhrm.github.io/2021/04/21/meson-msvc-github-actions/
# uses: bus1/cabuild/action/msdevshell@v1
# with:
# architecture: x86
# if: runner.os == 'Windows' && matrix.architecture == 'x86'
#- name: Update pip (avoids cryptography error) # https://stackoverflow.com/questions/59441794/error-could-not-build-wheels-for-cryptography-which-use-pep-517-and-cannot-be-i
# run: python -m pip install --upgrade pip
- name: Build wheels
uses: pypa/cibuildwheel@v2.12.1
#env:
# REEDSOLO_CYTHONIZE: 1 # unneeded now that cibuildwheel config is in pyproject.toml, we can use --config-settings instead
# CIBW_SOME_OPTION: value
# ...
# with:
# package-dir: .
# output-dir: wheelhouse
# config-file: "{package}/pyproject.toml"
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: python -m pip install build
- run: python -m build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_test_pypi: # Upload to TestPyPi first to ensure that the release is OK (we will try to download it and install it afterwards), as recommended in https://py-pkgs.org/08-ci-cd#uploading-to-testpypi-and-pypi
name: Upload to TestPyPi
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- name: Unpack default artifact into dist/
uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- name: Upload to TestPyPi
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/
# To test: repository_url: https://test.pypi.org/legacy/ # and also change password: ${{ secrets.PYPI_PASSWORD }} to secrets.TEST_PYPI_PASSWORD # for more infos on registering and using TestPyPi, read: https://py-pkgs.org/08-ci-cd#uploading-to-testpypi-and-pypi -- remove the repository_url to upload to the real PyPi
- name: Test install from TestPyPI
run: |
python -m pip install --upgrade pip
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
reedsolo
upload_pypi: # Upload to the real PyPi if everything else worked before, as suggested in: https://py-pkgs.org/08-ci-cd#uploading-to-testpypi-and-pypi
name: Upload to the real PyPi
needs: [build_wheels, build_sdist, upload_test_pypi]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}