-
Notifications
You must be signed in to change notification settings - Fork 12
130 lines (116 loc) · 4.5 KB
/
build-wheels.yml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build Python wheels
on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR
env:
SPHERICART_NO_LOCAL_DEPS: "1"
MACOSX_DEPLOYMENT_TARGET: "11.0"
jobs:
build-wheels:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}
strategy:
matrix:
# TODO: add windows builder
os: [ubuntu-20.04, macos-13]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel build
- name: Build sphericart wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist . --outdir dist
python -m cibuildwheel dist/*.tar.gz --output-dir dist
env:
CIBW_BUILD_VERBOSITY: 3
# build wheels on CPython 3.12
CIBW_BUILD: cp312-*
# skip musl and 32-bit builds
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
# on macOS, build both Intel & Apple Silicon versions
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# do not build wheels with -march=native
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF
- name: Build sphericart-torch wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist sphericart-torch --outdir sphericart-torch/dist
python -m cibuildwheel sphericart-torch/dist/*.tar.gz --output-dir sphericart-torch/dist
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: cp310-*
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
# we can not build wheels for macos-arm64, since the host is always
# x86_64, and we assume we can link against the host version of libtorch
CIBW_ARCHS_MACOS: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# Use the CPU only version of torch when building/running the code
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu
# do not complain for missing libtorch.so in sphericart-torch wheel
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair --exclude libtorch.so --exclude libtorch_cpu.so --exclude libc10.so -w {dest_dir} {wheel}
- name: Build sphericart-jax wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist sphericart-jax --outdir sphericart-jax/dist
python -m cibuildwheel sphericart-jax/dist/*.tar.gz --output-dir sphericart-jax/dist
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: cp310-*
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF
- uses: actions/upload-artifact@v3
with:
name: wheels
# only upload sphericart wheels, not sphericart-torch or sphericart-jax
path: dist/*.whl
- name: upload wheel to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
# only upload sphericart wheels, not sphericart-torch or sphericart-jax
files: dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-sdist:
runs-on: ubuntu-20.04
name: sdist
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: build sdist
run: |
python -m pip install build
python -m build --sdist . --outdir ./dist
python -m build --sdist sphericart-torch --outdir ./dist
python -m build --sdist sphericart-jax --outdir ./dist
- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/*.tar.gz
- name: upload sdist to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}