Skip to content

Commit 705cbb7

Browse files
authored
Fix release workflow (#481)
* release workflow updates * update * release on tags and update workflow * add req installtion back in * rewrite wheel creation using cibuildwheel * debug linux wheel repair failure * try new manylinux image * address libomp issue * try skipping repair wheel for linux * Fix installation of libomp * update manylinux image and update libomp installation to use custom script * remove custom repair command * try different ubuntu image * adjust mac build commands * try another image * try url for image * try 2 28 * try different url format * another url attempt * add env var to find .so * try gcc 10 linux binaries and add init for libepanet * use manylinux2014 * override repair command * remove tree and disable pytest/coverage steps * diable coverage/pytest * remove tree debug * update wheel download pattern * try fix for macos13 * fix rename block * update testpypi step * add dependencies for publish step * try another way * update coverage steps * fix upload artifact version * use original coverage commands * update step names and add old coverage steps
1 parent f3b64d2 commit 705cbb7

File tree

5 files changed

+84
-107
lines changed

5 files changed

+84
-107
lines changed

.github/workflows/build_tests.yml

+84-40
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,61 @@
11
# This workflow will install Python dependencies, run tests and lint with all currently supported python versions on all major plattforms
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: build
4+
name: GitHub CI
55

66
on:
77
push:
8-
branches: [ main, dev ]
8+
branches: [ main, dev, release ]
9+
tags:
10+
- '*'
911
pull_request:
10-
branches: [ main, dev ]
12+
branches: [ main, dev, release ]
1113
schedule:
1214
- cron: '0 0 1 * *'
1315

1416
jobs:
15-
16-
build:
17+
build_wheels:
18+
name: Build wheels
1719
runs-on: ${{ matrix.os }}
1820
strategy:
1921
matrix:
20-
python-version: ['3.9', '3.10', '3.11', '3.12']
21-
os: [windows-latest, macOS-13, macos-latest, ubuntu-latest]
22+
os: [ubuntu-latest, windows-latest, macOS-13, macos-latest]
2223
fail-fast: false
2324
steps:
24-
- name: Macos debug and set deployment target variable
25+
- name: Set env variables to handle macOS-13
2526
if: ${{ matrix.os == 'macOS-13'}}
2627
run: |
27-
xcodebuild -version
28-
echo $MACOSX_DEPLOYMENT_TARGET
29-
export MACOSX_DEPLOYMENT_TARGET=13.0
30-
echo $MACOSX_DEPLOYMENT_TARGET
31-
- uses: actions/checkout@v4
32-
- name: Set up Python
33-
uses: actions/setup-python@v5
34-
with:
35-
python-version: ${{ matrix.python-version }}
36-
- name: Install dependencies
37-
run: |
38-
python --version
39-
python -m pip install --upgrade pip
40-
pip install wheel
41-
pip install -r requirements.txt
42-
- name: Build macOS-13 # Special case due to unresolved wheel naming bug.
43-
if: ${{ matrix.os == 'macOS-13'}}
28+
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV
29+
echo "PLAT=macosx-13.0-universal2" >> $GITHUB_ENV
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
- name: Install libomp on macos
33+
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macOS-13'}}
4434
run: |
45-
python setup.py bdist_wheel --plat-name macosx-13.0-universal2 --verbose
46-
ls dist/*
47-
- name: Build all other OS
48-
if: ${{ matrix.os != 'macOS-13'}}
35+
brew reinstall --build-from-source --formula wntr/epanet/libepanet/darwin-formula/libomp.rb
36+
- name: Build wheels
37+
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
38+
env:
39+
CIBW_ENVIRONMENT: BUILD_WNTR_EXTENSIONS='true'
40+
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
41+
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
42+
CIBW_REPAIR_WHEEL_COMMAND: '' # Skip repair step
43+
- name: Fix macos13 wheel names # For some reason, they come out as macos14 instead of macos13
44+
if: ${{ matrix.os == 'macOS-13'}}
4945
run: |
50-
python setup.py bdist_wheel --verbose
51-
ls dist/*
52-
- name: Save wheel
53-
uses: actions/upload-artifact@v4
46+
for file in ./wheelhouse/*.whl; do
47+
new_name=$(echo "$file" | sed 's/macosx_14_0/macosx_13_0/')
48+
mv "$file" "$new_name"
49+
done
50+
- name: Upload wheels
51+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
5452
with:
55-
name: wntr_${{ matrix.python-version }}_${{ matrix.os }}.whl
56-
path: dist/wntr*
53+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
54+
path: ./wheelhouse/*.whl
5755

58-
install_import:
59-
needs: build
56+
test_wheels:
57+
name: Test wheels
58+
needs: build_wheels
6059
runs-on: ${{ matrix.os }}
6160
strategy:
6261
matrix:
@@ -71,7 +70,9 @@ jobs:
7170
- name: Download wheel
7271
uses: actions/download-artifact@v4
7372
with:
74-
name: wntr_${{ matrix.python-version }}_${{ matrix.os }}.whl
73+
# name: wntr_${{ matrix.python-version }}_${{ matrix.os }}.whl
74+
pattern: "cibw-wheels-*"
75+
merge-multiple: true
7576
- name: Install wntr
7677
run: |
7778
python -m pip install --upgrade pip
@@ -97,7 +98,8 @@ jobs:
9798
run: |
9899
pip install -r requirements.txt
99100
pytest wntr/tests/ --ignore=wntr/tests/test_demos.py --ignore=wntr/tests/test_examples.py
100-
pytest_coverage:
101+
102+
run_coverage:
101103
runs-on: ${{ matrix.os }}
102104
strategy:
103105
matrix:
@@ -143,7 +145,7 @@ jobs:
143145
include-hidden-files: true
144146

145147
combine_reports:
146-
needs: [ pytest_coverage ]
148+
needs: [ run_coverage ]
147149
runs-on: ubuntu-latest
148150
steps:
149151
- name: Set up Python
@@ -190,3 +192,45 @@ jobs:
190192
run: coveralls --service=github --rcfile=.coveragerc
191193
env:
192194
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195+
196+
build_sdist:
197+
name: Build SDist artifact 📦
198+
runs-on: ubuntu-latest
199+
steps:
200+
- uses: actions/checkout@v4
201+
- uses: actions/setup-python@v5
202+
with:
203+
python-version: '3.11'
204+
- name: Build SDist
205+
run: pipx run build --sdist
206+
- uses: actions/upload-artifact@v4
207+
with:
208+
name: sdist
209+
path: dist/*.tar.gz
210+
211+
publish-to-pypi:
212+
name: Publish Python 🐍 distribution 📦 to TestPyPI
213+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
214+
needs: [build_wheels, build_sdist]
215+
runs-on: ubuntu-latest
216+
environment:
217+
name: testpypi
218+
url: https://test.pypi.org/p/kbonney-wntr
219+
permissions:
220+
id-token: write
221+
steps:
222+
- name: Download wheel artifacts from build
223+
uses: actions/download-artifact@v4
224+
with:
225+
pattern: wntr_*
226+
path: dist
227+
merge-multiple: true
228+
- name: Download SDist artifact
229+
uses: actions/download-artifact@v4
230+
with:
231+
name: sdist
232+
path: dist
233+
- name: Publish distribution 📦 to TestPyPI
234+
uses: pypa/gh-action-pypi-publish@release/v1
235+
with:
236+
repository-url: https://test.pypi.org/legacy/

.github/workflows/release.yml

-67
This file was deleted.

wntr/epanet/libepanet/__init__.py

Whitespace-only changes.
-4.04 KB
Binary file not shown.
-40 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)