Build Wheels #58
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
name: Build Wheels | |
# Cross compile wheels only on main branch and tags | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
workflow_dispatch: | |
jobs: | |
build_nrtest_plugin: | |
name: Build nrtest-swmm plugin | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./nrtest-swmm | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Build wheel | |
run: | | |
pip install wheel | |
python setup.py bdist_wheel | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: nrtest-swmm/dist/*.whl | |
build_wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-2022, macos-12] | |
pyver: [cp38, cp39, cp310, cp311, cp312] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: ./swmm-toolkit | |
env: | |
CIBW_TEST_COMMAND: "pytest {package}/tests" | |
CIBW_BEFORE_TEST: pip install -r {package}/test-requirements.txt | |
# mac needs ninja to build | |
CIBW_BEFORE_BUILD_MACOS: brew install ninja | |
# configure cibuildwheel to build native archs ('auto'), and some emulated ones | |
CIBW_ARCHS_LINUX: x86_64 | |
CIBW_ARCHS_WINDOWS: AMD64 | |
CIBW_ARCHS_MACOS: x86_64 | |
# only build current supported python: https://devguide.python.org/versions/ | |
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs | |
CIBW_BUILD: ${{matrix.pyver}}-* | |
CIBW_SKIP: cp36-* cp37-* pp* *-musllinux* | |
# Will avoid testing on emulated architectures | |
# Skip trying to test arm64 builds on Intel Macs | |
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64" | |
CIBW_BUILD_VERBOSITY: 1 | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_cross_wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest,macos-12] | |
pyver: [cp38, cp39, cp310, cp311, cp312] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: ./swmm-toolkit | |
env: | |
# configure cibuildwheel to build native archs ('auto'), and some emulated ones | |
CIBW_ARCHS_LINUX: aarch64 | |
CIBW_ARCHS_MACOS: arm64 | |
# only build current supported python: https://devguide.python.org/versions/ | |
# don't build pypy or musllinux to save build time. TODO: find a good way to support those archs | |
CIBW_BUILD: ${{matrix.pyver}}-* | |
CIBW_SKIP: cp36-* cp37-* pp* *-musllinux* | |
CIBW_BUILD_VERBOSITY: 1 | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl |