-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (101 loc) · 3.56 KB
/
Copy pathpypi.yml
File metadata and controls
114 lines (101 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Deploy to PYPI
on:
workflow_dispatch:
jobs:
sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
- name: Build sdist
run: python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/*.tar.gz
wheels:
name: Build wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-14, windows-latest]
env:
MACOSX_DEPLOYMENT_TARGET: '15.0'
CIBW_BUILD_VERBOSITY: '1'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "cibuildwheel>=2.20,<3"
- if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
run: |
brew install cgal
# Cache vcpkg artifacts on Windows to avoid rebuilding dependencies every run
- name: Restore vcpkg cache
if: runner.os == 'Windows'
id: cache-vcpkg
uses: actions/cache@v4
with:
path: |
C:/vcpkg/installed
C:/vcpkg/packages
C:/vcpkg/downloads
C:/vcpkg/buildtrees
key: vcpkg-${{ runner.os }}-x64-windows-cgal-${{ hashFiles('.github/workflows/pypi.yml', 'CMakeLists.txt', 'pyproject.toml') }}
restore-keys: |
vcpkg-${{ runner.os }}-x64-windows-cgal-
- name: Install vcpkg dependencies (Windows only)
if: runner.os == 'Windows'
shell: pwsh
run: |
$Env:VCPKG_ROOT = "C:/vcpkg"
if (!(Test-Path $Env:VCPKG_ROOT)) {
git clone https://github.com/microsoft/vcpkg $Env:VCPKG_ROOT
}
if (!(Test-Path "$Env:VCPKG_ROOT/vcpkg.exe")) {
& "$Env:VCPKG_ROOT/bootstrap-vcpkg.bat"
}
# Only install if CGAL is missing for the target triplet
if (!(Test-Path "$Env:VCPKG_ROOT/installed/x64-windows/share/cgal")) {
& "$Env:VCPKG_ROOT/vcpkg.exe" install cgal --triplet x64-windows
}
echo "VCPKG_ROOT=$Env:VCPKG_ROOT" >> $Env:GITHUB_ENV
# now inject your extra CMake flags:
$toolchain = "$Env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
echo "CMAKE_ARGS=-DCMAKE_TOOLCHAIN_FILE=${toolchain} -DVCPKG_ROOT=${Env:VCPKG_ROOT}" >> $Env:GITHUB_ENV
echo $CMAKE_ARGS
- name: Build wheels
run: |
python -m cibuildwheel --output-dir dist
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./dist/*
publish:
name: Publish wheels and sdist to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
needs: [wheels,sdist]
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move all distributions to `dist/`
run: |
mkdir -p dist
find artifacts -name '*.whl' -exec cp {} dist/ \;
find artifacts -name '*.tar.gz' -exec cp {} dist/ \;
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
packages-dir: dist/