1- name : 🛠️ Build and test wheels
1+
2+ name : Deploy to PYPI
23
34on :
4- push :
5- branches : [main]
6- pull_request :
75 workflow_dispatch :
8-
96jobs :
10- build :
11- name : Build on ${{ matrix.os }} with Python ${{ matrix.python-version }}
7+
8+ sdist :
9+ name : Build sdist
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ - uses : actions/setup-python@v5
14+ - name : Install dependencies
15+ run : |
16+ python -m pip install --upgrade pip
17+ pip install build
18+ - name : Build sdist
19+ run : python -m build --sdist
20+ - uses : actions/upload-artifact@v4
21+ with :
22+ name : dist
23+ path : ./dist/*.tar.gz
24+ wheels :
25+ name : Build wheels
1226 runs-on : ${{ matrix.os }}
1327 strategy :
1428 fail-fast : false
1529 matrix :
16- os : [ubuntu-22.04 , macos-13, windows-2022 ]
17- python-version : ["3.9", "3.10", "3.11", "3.12"]
18-
30+ os : [ubuntu-latest , macos-latest, macos-14, windows-latest ]
31+ env :
32+ MACOSX_DEPLOYMENT_TARGET : ' 15.0 '
1933 steps :
20- - name : Checkout repository
21- uses : actions/checkout@v4
22-
23- - name : Setup Python
24- uses : actions/setup-python@v5
25- with :
26- python-version : ${{ matrix.python-version }}
27-
28- - name : Upgrade pip and install build tools
34+ - uses : actions/checkout@v4
35+ - uses : actions/setup-python@v5
36+ - name : Install dependencies
2937 run : |
3038 python -m pip install --upgrade pip
31- pip install build scikit-build-core pybind11 cibuildwheel
32-
33- # 🧩 Cache vcpkg on Windows
39+ pip install cibuildwheel
40+ - if : matrix.os == 'macos-latest' || matrix.os == 'macos-14'
41+ run : |
42+ brew install cgal
43+ # Cache vcpkg on Windows
3444 - name : Restore vcpkg cache
3545 if : runner.os == 'Windows'
3646 id : cache-vcpkg
@@ -50,26 +60,38 @@ jobs:
5060 if (!(Test-Path $Env:VCPKG_ROOT)) {
5161 git clone https://github.com/microsoft/vcpkg $Env:VCPKG_ROOT
5262 & "$Env:VCPKG_ROOT\bootstrap-vcpkg.bat"
63+ & $Env:VCPKG_ROOT\vcpkg.exe install yasm-tool:x86-windows cgal:x64-windows
5364 }
54- & "$Env:VCPKG_ROOT\vcpkg.exe" install yasm-tool:x86-windows cgal:x64-windows
55- echo "VCPKG_ROOT=$Env:VCPKG_ROOT" >> $env:GITHUB_ENV
56-
57- # 🐧 Linux / macOS system deps
58- - name : Install CGAL (Linux)
59- if : runner.os == 'Linux'
60- run : sudo apt-get update && sudo apt-get install -y libcgal-dev libgmp-dev libmpfr-dev
61-
62- - name : Install CGAL (macOS)
63- if : runner.os == 'macOS'
64- run : brew install cgal gmp mpfr
65-
66- # 🧱 Build the wheel
67- - name : Build wheel
65+ echo "VCPKG_ROOT=$Env:VCPKG_ROOT" >> $Env:GITHUB_ENV
66+ # now inject your extra CMake flags:
67+ $toolchain = "$Env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
68+ echo "CMAKE_ARGS=-DCMAKE_TOOLCHAIN_FILE=${toolchain//\\//} -DVCPKG_ROOT=${Env:VCPKG_ROOT//\\//}" >> $Env:GITHUB_EN
69+
70+ - name : Build wheels
6871 run : |
69- pip install .
70- python -c "import loop_cgal; print('✅ loop_cgal import successful')"
72+ cibuildwheel --output-dir dist
73+ - uses : actions/upload-artifact@v4
74+ with :
75+ name : wheels-${{ matrix.os }}
76+ path : ./dist/*
77+ publish :
78+ name : Publish wheels and sdist to PyPI
79+ runs-on : ubuntu-latest
80+ permissions :
81+ id-token : write
82+ needs : [wheels,sdist]
83+ steps :
84+ - uses : actions/download-artifact@v4
85+ with :
86+ path : artifacts
7187
72- # 🧪 Optional tests
73- - name : Run basic tests
88+ - name : Move all distributions to `dist/`
7489 run : |
75- python -c "import loop_cgal; print(loop_cgal.__doc__)"
90+ mkdir -p dist
91+ find artifacts -name '*.whl' -exec cp {} dist/ \;
92+ find artifacts -name '*.tar.gz' -exec cp {} dist/ \;
93+ - uses : pypa/gh-action-pypi-publish@release/v1
94+ with :
95+ skip-existing : true
96+ verbose : true
97+ packages-dir : dist/
0 commit comments