-
Notifications
You must be signed in to change notification settings - Fork 6
116 lines (104 loc) · 3.73 KB
/
python-wheels.yml
File metadata and controls
116 lines (104 loc) · 3.73 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
115
116
name: Build Python wheels
on:
workflow_dispatch:
inputs:
publish:
description: "Publish wheels to PyPI after building"
required: false
default: "false"
type: choice
options: ["true", "false"]
jobs:
build-wheels:
name: wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
cibw_archs_macos: arm64
- os: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Set up Python
uses: actions/setup-python@v5.6.0
with:
python-version: "3.11"
- name: Install build tooling
run: python -m pip install --upgrade pip cibuildwheel==2.*
- name: Set up ucrt64 (Windows only)
if: matrix.os == 'windows-latest'
shell: bash
run: |
C:/msys64/usr/bin/pacman -S --noconfirm --needed \
mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-make \
mingw-w64-ucrt-x86_64-curl \
mingw-w64-ucrt-x86_64-openssl
echo "C:/msys64/ucrt64/bin" >> "$GITHUB_PATH"
- name: Build wheels
env:
CIBW_SKIP: "pp*"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "${{ matrix.cibw_archs_macos }}"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_ENVIRONMENT_LINUX: "HARDENING_FLAGS='-fcf-protection=none -mno-shstk'"
CIBW_ENVIRONMENT_WINDOWS: >-
PATH="C:\\msys64\\ucrt64\\bin;$PATH"
CMAKE_GENERATOR="MinGW Makefiles"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_BEFORE_BUILD_MACOS: "pip install delocate"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >-
python /project/python/tools/wheel_fixup_platlib.py {wheel} &&
auditwheel repair -w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >-
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
python ${{ github.workspace }}\python\tools\wheel_fixup_platlib.py {wheel} &&
delvewheel repair --analyze-existing --add-path C:\msys64\ucrt64\bin -w {dest_dir} {wheel}
CIBW_BUILD_VERBOSITY: "1"
run: cibuildwheel --output-dir python/dist python
- name: Build sdist (linux only)
if: matrix.os == 'ubuntu-latest'
run: |
python -m pip install --upgrade build
make lib
cp build/lib/libGigaVector.so python/src/gigavector/
python -m build -s python -o python/dist
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4.6.2
with:
name: wheels-${{ matrix.os }}-${{ matrix.cibw_archs_macos || 'native' }}
path: python/dist/*
retention-days: 30
publish:
name: publish to PyPI
if: inputs.publish == 'true'
runs-on: ubuntu-latest
needs: [build-wheels]
permissions:
contents: read
id-token: write
steps:
- name: Download wheel artifacts
uses: actions/download-artifact@v4.3.0
with:
path: dist-artifacts
- name: Flatten dist directory
run: |
mkdir -p python/dist
find dist-artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) | while read -r f; do
cp "$f" python/dist/
done
ls -la python/dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python/dist/
print-hash: true
verbose: true