Skip to content

Commit 9a926ae

Browse files
author
Sam Rensenhouse
committed
building wheels for all platforms, currently only on manual triggers
1 parent f492d41 commit 9a926ae

1 file changed

Lines changed: 100 additions & 21 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 100 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
1-
name: Build Wheels
1+
name: Build wheels
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_dispatch:
45

56
jobs:
6-
build_toolkit_wheels:
7-
name: Build MacOS python 3.8
8-
runs-on: macos-10.15
9-
defaults:
10-
run:
11-
working-directory: ./owa-epanet
7+
build_wheels:
8+
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ windows-latest, ubuntu-latest, macos-latest ]
14+
python: [ 36, 37, 38, 39, 310]
15+
bitness: [ 32, 64 ]
16+
include:
17+
# Run 32 and 64 bit version in parallel for Linux and Windows
18+
- os: windows-latest
19+
bitness: 64
20+
platform_id: win_amd64
21+
- os: windows-latest
22+
bitness: 32
23+
platform_id: win32
24+
- os: ubuntu-latest
25+
bitness: 64
26+
platform_id: manylinux_x86_64
27+
- os: macos-latest
28+
bitness: 64
29+
platform_id: macosx_x86_64
30+
exclude:
31+
- os: macos-latest
32+
bitness: 32
33+
# This build was broken on OpenMP so is excluded for now
34+
- os: ubuntu-latest
35+
bitness: 32
1236

1337
steps:
1438
- name: Checkout repo
@@ -18,24 +42,79 @@ jobs:
1842

1943
- name: Install Python
2044
uses: actions/setup-python@v2
45+
46+
- uses: ilammy/msvc-dev-cmd@v1
47+
if: startsWith(matrix.os, 'windows')
48+
49+
- name: Install cibuildwheel
50+
run: python -m pip install cibuildwheel==2.2.0a1
51+
52+
- name: Build wheels
53+
run: python -m cibuildwheel --output-dir wheelhouse owa-epanet
54+
env:
55+
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
56+
CIBW_BEFORE_ALL_LINUX: git submodule update --init && yum install swig -y
57+
CIBW_BEFORE_ALL_WINDOWS: git submodule update && choco install swig
58+
CIBW_BEFORE_ALL_MACOS: git submodule update && brew install swig ninja libomp
59+
CIBW_BEFORE_BUILD: pip install scikit-build==0.11.1 cmake==3.18.4
60+
CIBW_BUILD_VERBOSITY: 1
61+
CIBW_TEST_COMMAND: pytest {package}
62+
CIBW_BEFORE_TEST: pip install scikit-build==0.11.1 cmake==3.18.4
63+
CIBW_TEST_REQUIRES: pytest
64+
65+
- name: Store artifacts
66+
uses: actions/upload-artifact@v2
2167
with:
22-
python-version: 3.8
68+
path: ./wheelhouse/*.whl
69+
70+
71+
build_sdist:
72+
name: Build source distribution
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v2
76+
with:
77+
submodules: true
2378

24-
- name: Install required system packages
25-
run: brew install swig
79+
# Had issues with not all files being pulled and this somehow resolved it
80+
- name: Fix submodules
81+
run: |
82+
cd owa-epanet
83+
rm -rf EPANET
84+
git submodule update
85+
86+
- uses: actions/setup-python@v2
87+
name: Install Python
88+
with:
89+
python-version: '3.8'
2690

27-
- name: Build wheel
91+
- name: Install dependencies
2892
run: |
29-
pip install scikit-build
30-
python setup.py bdist_wheel
93+
sudo apt update
94+
sudo apt install swig -y
95+
pip install scikit-build==0.11.1 cmake==3.18.4
3196
32-
- name: Test wheel
97+
- name: Build sdist
3398
run: |
34-
pip install pytest
35-
pip install --no-index --find-links=./dist owa-epanet
36-
pytest
99+
cd owa-epanet
100+
python setup.py sdist
37101
38-
- name: Upload artifacts
39-
uses: actions/upload-artifact@v2
102+
- uses: actions/upload-artifact@v2
103+
with:
104+
path: owa-epanet/dist/*.tar.gz
105+
106+
upload_pypi:
107+
needs: [ build_wheels, build_sdist ]
108+
runs-on: ubuntu-latest
109+
110+
steps:
111+
- uses: actions/download-artifact@v2
112+
with:
113+
name: artifact
114+
path: owa-epanet/dist
115+
116+
- uses: pypa/gh-action-pypi-publish@v1.4.2
40117
with:
41-
path: owa-epanet/dist/*.whl
118+
user: __token__
119+
password: ${{ secrets.PYPI_API_TOKEN }}
120+
repository_url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)