-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use cibuildwheel in pythonpackage.yml * Arm, sdist, musli, windows builds. (#18) * # Conflicts: # .github/workflows/pythonpackage.yml * clean up. * clean up finished. * Removed setup python step. It is final request, nothing left to make smaller in yml. Co-authored-by: Alexander Piskun <[email protected]>
- Loading branch information
1 parent
21699d4
commit c64d2c2
Showing
7 changed files
with
380 additions
and
144 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -3,80 +3,209 @@ name: build | |
on: | ||
push: | ||
branches: [ master ] | ||
tags: | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ${{ matrix.platform }} | ||
name: Testing with Python 3.${{ matrix.python_minor }} on Linux | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] | ||
platform: [ubuntu-latest, macos-latest, windows-latest] | ||
python_minor: [ "6" , "7" , "8" , "9" , "10" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install cibuildwheel | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install cibuildwheel twine | ||
- name: 🛠 Build and Test Hexhamming Python C extension | ||
run: cibuildwheel | ||
env: | ||
CIBW_BUILD: ${{ format('cp3{0}-manylinux_x86_64', matrix.python_minor) }} | ||
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt | ||
CIBW_TEST_COMMAND: "pytest -s {project}" | ||
CIBW_BUILD_VERBOSITY: 1 | ||
|
||
- name: Check built wheels | ||
run: twine check wheelhouse/* | ||
|
||
sdist: | ||
if: startsWith(github.ref, 'refs/tags') | ||
needs: build-and-test | ||
name: Source distribution | ||
runs-on: macos-11 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: 🐍 Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
- name: Install requirements | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-dev.txt | ||
- name: 🛠 Build Hexhamming Python C extension | ||
run: python setup.py install | ||
- name: Test with pytest | ||
run: pytest -s . | ||
build-wheels: | ||
needs: build-and-test | ||
if: startsWith(github.ref, 'refs/tags') | ||
steps: | ||
pip3 install --user check-manifest twine | ||
python3 -m pip install --upgrade pip setuptools wheel | ||
python3 -m pip install -r requirements-dev.txt | ||
- name: Run check-manifest | ||
run: python3 -m check_manifest | ||
|
||
- name: Set up QEMU | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Build sdist | ||
run: python3 -m build --sdist --outdir wheelhouse | ||
|
||
- name: Install from sdist | ||
run: pip3 install --user wheelhouse/*.tar.gz | ||
|
||
- name: Check sdist | ||
run: python3 -m twine check wheelhouse/* | ||
|
||
- name: Upload sdist | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
platforms: all | ||
name: wheels | ||
path: wheelhouse/*.tar.gz | ||
|
||
wheels_macos: | ||
if: startsWith(github.ref, 'refs/tags') | ||
needs: [build-and-test, sdist] | ||
name: Build macOS ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels | ||
runs-on: macos-11 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
cibw_python: [ "cp38-*", "cp39-*", "cp310-*" ] | ||
cibw_arch: [ "x86_64", "arm64" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install cibuildwheel | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install cibuildwheel twine | ||
echo DEPLOYMENT_TARGET=10.9 >> $GITHUB_ENV | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
- name: Changing deployment target | ||
if: matrix.cibw_arch == 'arm64' | ||
run: echo DEPLOYMENT_TARGET=12.0 >> $GITHUB_ENV | ||
|
||
- name: 🛠 Build Hexhamming Python C extension | ||
run: cibuildwheel | ||
env: | ||
# configure cibuildwheel to build native archs ('auto'), and some | ||
# emulated ones | ||
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x arm64 universal2 | ||
CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=${{ env.DEPLOYMENT_TARGET }} | ||
CIBW_BUILD: ${{ matrix.cibw_python }} | ||
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} | ||
CIBW_TEST_SKIP: "*-macosx_arm64" | ||
CC: /usr/bin/clang | ||
CXX: /usr/bin/clang++ | ||
CFLAGS: "-Wno-implicit-function-declaration" | ||
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt | ||
CIBW_TEST_COMMAND: "pytest -s {project}" | ||
CIBW_BUILD_VERBOSITY: 1 | ||
|
||
- name: Check built wheels | ||
run: twine check wheelhouse/* | ||
|
||
# Upload the wheels | ||
- name: Upload wheels for next job | ||
uses: actions/upload-artifact@master | ||
- name: Upload built wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
path: wheelhouse/*.whl | ||
if-no-files-found: error | ||
|
||
publish-wheels: | ||
needs: build-wheels | ||
wheels_linux: | ||
if: startsWith(github.ref, 'refs/tags') | ||
runs-on: ubuntu-latest | ||
needs: [build-and-test, sdist] | ||
name: Build ${{ matrix.cibw_buildlinux }} ${{ matrix.cibw_arch }} wheels | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ['3.9'] | ||
cibw_buildlinux: [ manylinux, musllinux ] | ||
cibw_arch: [ "x86_64", "aarch64" ] | ||
|
||
steps: | ||
- name: 🐍 Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Download wheels from previous job | ||
uses: actions/download-artifact@master | ||
- uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
if: matrix.cibw_arch == 'aarch64' | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: arm64 | ||
|
||
- name: Install cibuildwheel | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install cibuildwheel twine | ||
- name: 🛠 Build Hexhamming Python C extension | ||
run: cibuildwheel | ||
env: | ||
CIBW_BUILD: ${{ format('cp3*-{0}*', matrix.cibw_buildlinux) }} | ||
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }} | ||
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt | ||
CIBW_TEST_COMMAND: "pytest -s {project}" | ||
CIBW_BUILD_VERBOSITY: 1 | ||
|
||
- name: Check built wheels | ||
run: twine check wheelhouse/* | ||
|
||
- name: Upload built wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: wheelhouse/*.whl | ||
if-no-files-found: error | ||
|
||
wheels_windows: | ||
if: startsWith(github.ref, 'refs/tags') | ||
needs: [build-and-test, sdist] | ||
name: Build Windows wheels | ||
runs-on: windows-2019 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install cibuildwheel | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install cibuildwheel twine | ||
- name: 🛠 Build Hexhamming Python C extension | ||
run: cibuildwheel | ||
env: | ||
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310-*" | ||
CIBW_ARCHS_WINDOWS: "AMD64" | ||
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt | ||
CIBW_TEST_COMMAND: "pytest -s {project}" | ||
CIBW_BUILD_VERBOSITY: 1 | ||
|
||
- name: Check built wheels | ||
run: twine check wheelhouse/* | ||
|
||
- name: Upload built wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: wheelhouse/*.whl | ||
if-no-files-found: error | ||
|
||
publish-wheels: | ||
if: startsWith(github.ref, 'refs/tags') | ||
needs: [wheels_macos, wheels_linux, wheels_windows] | ||
name: Publish wheels | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Collect sdist and wheels | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
path: wheelhouse | ||
|
||
- name: Install twine | ||
run: python -m pip install twine | ||
|
||
- name: 📦 Publish distribution to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: twine upload dist/*.whl | ||
run: twine upload wheelhouse/*.whl |
This file contains 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,3 +1,6 @@ | ||
include README.rst | ||
include requirements.txt | ||
include requirements-dev.txt | ||
include pytest.ini | ||
|
||
graft test | ||
graft hexhamming |
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
const char _version[] = "2.2.0"; |
Oops, something went wrong.