-
Notifications
You must be signed in to change notification settings - Fork 149
175 lines (152 loc) · 4.84 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Build wheels
on:
push:
branches:
- 'main'
workflow_dispatch:
jobs:
build-extra:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Should include history since the last tag for setuptools_scm to work
fetch-depth: 200
fetch-tags: true
- name: Build Wheels
run: |
pip3 install build
python3 -m build --sdist --wheel third_party/skymarshal --outdir ./dist
python3 -m build --sdist --wheel gen/python --outdir ./dist
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: symforce-wheels-extra
path: dist/*
build-macos:
# This is macos 13 instead of newer, because brew won't pull libgmp for an older macos, so we
# just support 13 or newer
runs-on: macos-13
strategy:
fail-fast: false
matrix:
os:
- runner: macos-13
arch: x86_64
- runner: macos-13
arch: arm64
python-version: [cp38, cp39, cp310, cp311, cp312]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Should include history since the last tag for setuptools_scm to work
fetch-depth: 200
fetch-tags: true
- run: python3 -m pip install setuptools_scm
- run: echo "SYMFORCE_VERSION=$(python3 -m setuptools_scm)" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python-version }}-*
CIBW_ARCHS_MACOS: ${{ matrix.os.arch }}
CIBW_BUILD_FRONTEND: build
# For arm64; for x86, it's at /usr/local but cmake finds that ok already
GMP_ROOT: /opt/homebrew
CIBW_BEFORE_BUILD: brew install gmp
CIBW_ENVIRONMENT: SYMFORCE_REWRITE_LOCAL_DEPENDENCIES=$SYMFORCE_VERSION MACOSX_DEPLOYMENT_TARGET=13.0
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: symforce-wheels-${{ matrix.os.arch }}-${{ matrix.python-version }}
path: wheelhouse/*.whl
build-linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [cp38, cp39, cp310, cp311, cp312]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Should include history since the last tag for setuptools_scm to work
fetch-depth: 200
fetch-tags: true
- run: python3 -m pip install setuptools_scm
- run: echo "SYMFORCE_VERSION=$(python3 -m setuptools_scm)" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python-version }}-manylinux_x86_64
CIBW_BUILD_FRONTEND: build
CIBW_BEFORE_BUILD: yum install -y gmp-devel git
CIBW_ENVIRONMENT: SYMFORCE_REWRITE_LOCAL_DEPENDENCIES=$SYMFORCE_VERSION
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: symforce-wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: wheelhouse/*.whl
merge-wheel-artifacts:
runs-on: ubuntu-latest
needs:
- build-extra
- build-macos
- build-linux
steps:
- uses: actions/upload-artifact/merge@v4
with:
name: symforce-wheels
delete-merged: true
publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
strategy:
matrix:
package: [symforce, symforce_sym, skymarshal]
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- merge-wheel-artifacts
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/${{ matrix.package }}
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: symforce-wheels
path: wheels-download/
- run: mkdir dist && cp wheels-download/${{ matrix.package }}-*.whl dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
strategy:
matrix:
package: [symforce, symforce_sym, skymarshal]
needs:
- merge-wheel-artifacts
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/${{ matrix.package }}
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: symforce-wheels
path: wheels-download/
- run: mkdir dist && cp wheels-download/${{ matrix.package }}-*.whl dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true