Skip to content

Commit 3c09638

Browse files
authored
Merge pull request #300 from lonvia/rewrite-build-system
Modernize build system
2 parents 82865cd + c7bb02e commit 3c09638

File tree

18 files changed

+296
-464
lines changed

18 files changed

+296
-464
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/build_wheels.yml

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,51 @@ on:
77

88
jobs:
99
build_wheels:
10-
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
10+
name: Build wheels on ${{ matrix.os }}
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
16-
arch: [native]
15+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest]
16+
vcpkg: [none]
1717
include:
18-
- os: ubuntu-20.04
19-
arch: aarch64
18+
- os: windows-latest
19+
vcpkg: 'C:/vcpkg/installed/x64-windows'
20+
- os: windows-11-arm
21+
vcpkg: 'C:/vcpkg/installed/arm64-windows'
2022

2123
steps:
2224
- uses: actions/checkout@v4
2325

24-
- uses: actions/checkout@v4
25-
with:
26-
repository: pybind/pybind11
27-
ref: v2.11.1
28-
path: contrib/pybind11
29-
30-
- uses: actions/checkout@v4
31-
with:
32-
repository: mapbox/protozero
33-
ref: v1.7.1
34-
path: contrib/protozero
35-
36-
- uses: actions/checkout@v4
26+
- uses: actions/setup-python@v5
3727
with:
38-
repository: osmcode/libosmium
39-
ref: v2.20.0
40-
path: contrib/libosmium
28+
python-version: '3.13'
4129

42-
- name: Set up QEMU
43-
uses: docker/setup-qemu-action@v3
44-
if: ${{ matrix.arch == 'aarch64' }}
30+
- name: Install requirements
31+
run: python -m pip install cibuildwheel build
4532

46-
- uses: actions/setup-python@v5
47-
with:
48-
python-version: '3.8'
33+
- name: Get dependencies via sdist
34+
run: python -m build --sdist
4935

5036
- name: Build wheels
51-
uses: pypa/[email protected]
37+
run: |
38+
python -m cibuildwheel --output-dir wheelhouse
39+
shell: bash
5240
env:
53-
CIBW_ARCHS: ${{ matrix.arch }}
54-
CIBW_SKIP: "pp* *musllinux* cp37-macosx_* {cp37,cp38}-*linux_aarch64"
55-
CIBW_TEST_REQUIRES: pytest pytest-httpserver shapely
56-
CIBW_TEST_REQUIRES_LINUX: urllib3<2.0 pytest pytest-httpserver shapely
41+
CIBW_ENABLE: cpython-freethreading
42+
CIBW_ARCHS: "native"
43+
CIBW_SKIP: "*musllinux*"
44+
CIBW_TEST_REQUIRES: pytest pytest-httpserver
5745
CIBW_TEST_COMMAND: pytest {project}/test
5846
CIBW_BUILD_FRONTEND: build
5947
CIBW_BEFORE_BUILD_LINUX: yum install -y expat-devel boost-devel zlib-devel bzip2-devel lz4-devel
6048
CIBW_BEFORE_BUILD_MACOS: brew install boost
61-
CIBW_BEFORE_BUILD_WINDOWS: vcpkg install bzip2:x64-windows expat:x64-windows zlib:x64-windows boost-variant:x64-windows boost-iterator:x64-windows lz4:x86-windows
49+
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0 SKBUILD_CMAKE_ARGS=-DWITH_LZ4=OFF
50+
CIBW_BEFORE_BUILD_WINDOWS: vcpkg install bzip2 expat zlib boost-variant boost-iterator lz4
6251
CIBW_ENVIRONMENT_WINDOWS: 'CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"'
63-
CIBW_ENVIRONMENT_MACOS: CMAKE_WITH_LZ4=OFF MACOSX_DEPLOYMENT_TARGET=11.0
52+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: 'pipx run delvewheel repair --add-path ${{ matrix.vcpkg }}/bin/ --add-path ${{ matrix.vcpkg }}/debug/bin -w {dest_dir} {wheel}'
6453

6554
- uses: actions/upload-artifact@v4
6655
with:
67-
name: pyosmium-wheels-${{ matrix.os }}-${{ matrix.arch }}
56+
name: pyosmium-wheels-${{ matrix.os }}
6857
path: ./wheelhouse/*.whl

.github/workflows/ci.yml

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ jobs:
268268
runs-on: ${{ matrix.platform }}
269269

270270
strategy:
271+
fail-fast: false
271272
matrix:
272273
compiler: [gcc-old, clang-old, gcc, clang, macos-intel, macos-arm]
273274
include:
@@ -317,47 +318,60 @@ jobs:
317318
steps:
318319
- uses: actions/checkout@v4
319320

320-
- name: Install prerequisites
321+
- name: Clean up build environment
321322
run: |
322323
# Workaround for github/brew problem. Python is already install
323324
# on the Github action runner and then homebrew comes along...
324325
# See also: https://github.com/Homebrew/homebrew-core/issues/173191
325326
rm -f /usr/local/bin/2to3* /usr/local/bin/idle3* /usr/local/bin/pydoc3* /usr/local/bin/python3*
326327
if: ${{ matrix.flavour == 'macos' }}
327328

328-
- uses: ./.github/actions/install-dependencies
329-
with:
330-
version: ${{ matrix.deps }}
331-
332-
- uses: actions/setup-python@v5
333-
with:
334-
python-version: "${{ matrix.python }}"
335-
allow-prereleases: true
336-
337329
- name: Install packages
338330
run: |
339331
sudo apt-get update -y -qq
340-
sudo apt-get install -y -qq libboost-dev libexpat1-dev zlib1g-dev libbz2-dev libproj-dev libgeos-dev liblz4-dev
332+
sudo apt-get install -y -qq libboost-dev libexpat1-dev zlib1g-dev libbz2-dev libproj-dev libgeos-dev liblz4-dev virtualenv
341333
if: ${{ matrix.flavour == 'linux' }}
342334

343335
- name: Install packages
344-
run: brew install boost geos
336+
run: brew install boost geos virtualenv
345337
shell: bash
346338
if: ${{ matrix.flavour == 'macos' }}
347339

348-
- name: Install prerequisites
340+
- name: Setup virtualenv
349341
run: |
350-
python -m pip install --upgrade pip
351-
pip install -U pytest pytest-httpserver shapely setuptools requests
342+
virtualenv venv
343+
./venv/bin/pip install build
344+
345+
- name: Install package dependencies (develop)
346+
run: |
347+
git clone --quiet --depth 1 https://github.com/osmcode/libosmium.git contrib/libosmium
348+
git clone --quiet --depth 1 https://github.com/mapbox/protozero.git contrib/protozero
349+
git clone --quiet https://github.com/pybind/pybind11.git contrib/pybind11
352350
shell: bash
351+
if: ${{ matrix.deps == 'develop' }}
352+
353+
- name: Install package dependencies (release)
354+
run: |
355+
./venv/bin/python -m build --sdist
356+
shell: bash
357+
if: ${{ matrix.deps == 'release' }}
358+
359+
- uses: actions/setup-python@v5
360+
with:
361+
python-version: "${{ matrix.python }}"
362+
allow-prereleases: true
353363

354364
- name: Build package
355-
run: python setup.py build
365+
run: |
366+
./venv/bin/python -m build -w
356367
shell: bash
357368

358369
- name: Run tests
359370
run: |
360-
pytest test
371+
WHEEL=`ls dist/osmium*.whl`
372+
echo "Installing $WHEEL"
373+
./venv/bin/pip install dist/osmium*whl ${WHEEL}[tests]
374+
./venv/bin/pytest test
361375
shell: bash
362376

363377

@@ -476,11 +490,16 @@ jobs:
476490
env:
477491
CMAKE_TOOLCHAIN_FILE: C:/vcpkg/scripts/buildsystems/vcpkg.cmake
478492

493+
- name: Repair wheels
494+
run: |
495+
pip install delvewheel
496+
delvewheel repair --add-path C:/vcpkg/installed/x64-windows/bin/ --add-path C:/vcpkg/installed/x64-windows/debug/bin dist/*.whl
497+
479498
- name: 'Upload Artifact'
480499
uses: actions/upload-artifact@v4
481500
with:
482501
name: pyosmium-win64-dist
483-
path: dist
502+
path: wheelhouse
484503

485504
build-windows-free-threaded:
486505
runs-on: windows-2022
@@ -502,7 +521,8 @@ jobs:
502521
shell: bash
503522

504523
- name: Install packages
505-
run: vcpkg install bzip2:x64-windows expat:x64-windows zlib:x64-windows boost-variant:x64-windows boost-iterator:x64-windows lz4:x86-windows
524+
run: |
525+
vcpkg install bzip2:x64-windows expat:x64-windows zlib:x64-windows boost-variant:x64-windows boost-iterator:x64-windows lz4:x86-windows
506526
shell: bash
507527

508528
- name: Set up Python 3.13t
@@ -532,11 +552,16 @@ jobs:
532552
env:
533553
CMAKE_TOOLCHAIN_FILE: C:/vcpkg/scripts/buildsystems/vcpkg.cmake
534554

555+
- name: Repair wheels
556+
run: |
557+
pip install delvewheel
558+
delvewheel repair --add-path C:/vcpkg/installed/x64-windows/bin/ --add-path C:/vcpkg/installed/x64-windows/debug/bin dist/*.whl
559+
535560
- name: 'Upload Artifact'
536561
uses: actions/upload-artifact@v4
537562
with:
538563
name: pyosmium-win64-dist-t
539-
path: dist
564+
path: wheelhouse
540565

541566

542567
test-windows:
@@ -599,7 +624,7 @@ jobs:
599624

600625
test-windows-free-threaded:
601626
runs-on: windows-2022
602-
needs: build-windows
627+
needs: build-windows-free-threaded
603628

604629
strategy:
605630
fail-fast: false
@@ -646,7 +671,8 @@ jobs:
646671
if: matrix.python-version == '3.14t'
647672

648673
- name: Run tests
649-
run: ./osmium-test/Scripts/pytest test --parallel-threads 5 --iterations 5
674+
run: |
675+
./osmium-test/Scripts/pytest test --parallel-threads 5 --iterations 5
650676
shell: bash
651677

652678
- name: Check tool availability

0 commit comments

Comments
 (0)