Skip to content

Commit c40f3f6

Browse files
author
Sam Hatchett
committed
updates action workflow for pypi build/publish
1 parent 1846801 commit c40f3f6

2 files changed

Lines changed: 33 additions & 47 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 32 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,75 +5,53 @@ on:
55

66
jobs:
77
build_wheels:
8-
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}
8+
name: Build wheels (simple matrix)
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
fail-fast: false
1212
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
13+
os: [windows-latest, ubuntu-latest, macos-latest]
14+
python_tag: [cp39, cp310, cp311, cp312, cp313, cp314]
3615

3716
steps:
3817
- name: Checkout repo
39-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
4019
with:
4120
submodules: true
4221

43-
- name: Install Python
44-
uses: actions/setup-python@v2
45-
46-
- uses: ilammy/msvc-dev-cmd@v1
47-
if: startsWith(matrix.os, 'windows')
48-
4922
- name: Install cibuildwheel
50-
run: python -m pip install cibuildwheel==2.3.1
23+
run: python -m pip install cibuildwheel==2.22.0
5124

5225
- name: Build wheels
5326
run: python -m cibuildwheel --output-dir wheelhouse owa-epanet
5427
env:
55-
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
56-
CIBW_BEFORE_ALL_LINUX: git submodule update --init && yum install swig -y
28+
# Build the specific Python tag (e.g. cp39, cp310) for the current matrix entry
29+
CIBW_BUILD: ${{ matrix.python_tag }}-*
30+
# Use manylinux_2_28 (dnf-based) for Linux builds
31+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
32+
CIBW_BEFORE_ALL_LINUX: git submodule update --init && dnf install swig -y
5733
CIBW_BEFORE_ALL_WINDOWS: git submodule update && choco install swig
5834
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
35+
CIBW_BEFORE_BUILD: pip install scikit-build cmake
6036
CIBW_BUILD_VERBOSITY: 1
6137
CIBW_TEST_COMMAND: pytest {package}
62-
CIBW_BEFORE_TEST: pip install scikit-build==0.11.1 cmake==3.18.4
38+
CIBW_BEFORE_TEST: pip install scikit-build cmake
6339
CIBW_TEST_REQUIRES: pytest
40+
# skip 32-bit manylinux and win32 test variants
6441
CIBW_TEST_SKIP: "*-win32 *-manylinux_i686"
6542

6643
- name: Store artifacts
67-
uses: actions/upload-artifact@v2
44+
uses: actions/upload-artifact@v4
6845
with:
46+
name: wheels-${{ matrix.os }}-${{ matrix.python_tag }}
6947
path: ./wheelhouse/*.whl
7048

7149

7250
build_sdist:
7351
name: Build source distribution
7452
runs-on: ubuntu-latest
7553
steps:
76-
- uses: actions/checkout@v2
54+
- uses: actions/checkout@v4
7755
with:
7856
submodules: true
7957

@@ -82,38 +60,45 @@ jobs:
8260
cd owa-epanet
8361
git submodule update
8462
85-
- uses: actions/setup-python@v2
63+
- uses: actions/setup-python@v5
8664
name: Install Python
8765
with:
88-
python-version: '3.8'
66+
python-version: "3.12"
8967

9068
- name: Install dependencies
9169
run: |
9270
sudo apt update
9371
sudo apt install swig -y
94-
pip install scikit-build==0.11.1 cmake==3.18.4
72+
pip install build scikit-build cmake
9573
9674
- name: Build sdist
9775
run: |
9876
cd owa-epanet
99-
python setup.py sdist
77+
python -m build --sdist
10078
101-
- uses: actions/upload-artifact@v2
79+
- uses: actions/upload-artifact@v4
10280
with:
81+
name: sdist
10382
path: owa-epanet/dist/*.tar.gz
10483

10584
upload_pypi:
10685
needs: [ build_wheels, build_sdist ]
10786
runs-on: ubuntu-latest
10887

10988
steps:
110-
- uses: actions/download-artifact@v2
89+
- uses: actions/download-artifact@v4
90+
with:
91+
path: dist
92+
pattern: wheels-*
93+
merge-multiple: true
94+
95+
- uses: actions/download-artifact@v4
11196
with:
112-
name: artifact
11397
path: dist
98+
pattern: sdist
99+
merge-multiple: true
114100

115-
- uses: pypa/gh-action-pypi-publish@v1.4.2
101+
- uses: pypa/gh-action-pypi-publish@release/v1
116102
with:
117-
user: __token__
118103
password: ${{ secrets.PYPI_API_TOKEN }}
119104
skip_existing: true

owa-epanet/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[build-system]
22
requires = ["setuptools", "wheel", "scikit-build", "cmake"]
3+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)