-
Notifications
You must be signed in to change notification settings - Fork 0
222 lines (191 loc) · 5.93 KB
/
build_wheel.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Build Wheels (Testing)
on:
push:
branches: ["fix-workflow"]
paths: ["dither_go/**", ".github/workflows/build_wheel.yml"]
pull_request:
paths: ["dither_go/**", ".github/workflows/build_wheel.yml"]
workflow_dispatch:
workflow_call:
jobs:
build_macos:
#if: false
name: MacOS ${{ matrix.arch_cibw_go[0] }}
strategy:
fail-fast: false
matrix:
arch_cibw_go:
- [ "x86_64", "amd64" ]
- [ "arm64", "arm64" ]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20.x"
- name: Install gopy
run: go install github.com/go-python/gopy@v0.4.7
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Build wheels
run: ./tools/macos_build_wheels.sh
env:
CIBW_ARCHS: ${{ matrix.arch_cibw_go[0] }}
PYTHON_BINARY_PATH: /usr/local/bin/python_for_build
CIBW_ENVIRONMENT: >
PATH=$PATH:/usr/local/go/bin
GOARCH=${{ matrix.arch_cibw_go[1] }}
CGO_ENABLED=1
MACOSX_DEPLOYMENT_TARGET=10.15
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
build_linux_x86_64:
#if: false
name: Linux x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
with:
package-dir: .
env:
CIBW_BUILD: "cp3*_x86_64"
CIBW_SKIP: "cp36-* cp37-* *-musllinux_x86_64"
CIBW_ARCHS: "native"
CIBW_ENVIRONMENT: >
PATH=$PATH:/usr/local/go/bin
CGO_ENABLED=1
CIBW_BEFORE_ALL_LINUX: |
curl -o go.tar.gz https://dl.google.com/go/go1.20.7.linux-amd64.tar.gz
tar -C /usr/local -xzf go.tar.gz
go install github.com/go-python/gopy@v0.4.7
go install golang.org/x/tools/cmd/goimports@latest
curl -o libwebp.tar.gz https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.1-linux-x86-64.tar.gz
tar -xzf libwebp.tar.gz
cp -r libwebp-1.3.1-linux-x86-64/include libwebp-1.3.1-linux-x86-64/lib /usr/local
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
build_linux_arm64:
#if: false
name: Linux arm64
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python3_version: [ 8, 9, 10, 11 ]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build 3.${{ matrix.python3_version }} wheels
uses: pypa/cibuildwheel@v2.15.0
with:
package-dir: .
env:
CIBW_BUILD: "cp3${{ matrix.python3_version }}*_aarch64"
CIBW_SKIP: "cp36-* cp37-* *-musllinux_aarch64"
CIBW_ARCHS: "aarch64"
CIBW_ENVIRONMENT: >
PATH=$PATH:/usr/local/go/bin
CGO_ENABLED=1
CIBW_BEFORE_ALL_LINUX: |
curl -o go.tar.gz https://dl.google.com/go/go1.20.7.linux-arm64.tar.gz
tar -C /usr/local -xzf go.tar.gz
go install github.com/go-python/gopy@v0.4.7
go install golang.org/x/tools/cmd/goimports@latest
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
build_linux_armv7l:
#if: false
name: Linux armv7l
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python3_version: [ 8, 9, 10, 11 ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build 3.${{ matrix.python3_version }} wheels via Docker
uses: docker/build-push-action@v3
with:
context: .
file: ./tools/Dockerfile.armv7l
build-args: |
PYTHON3_VERSION=${{ matrix.python3_version }}
push: false
platforms: linux/armhf
tags: armv7l:latest
load: true
- name: Extract output
run: |
docker run -v /tmp/output:/host armv7l:latest bash -c "cp /export/* /host/"
tar -zcvf /tmp/output.tar.gz /tmp/output
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: /tmp/output/*.whl
build_windows:
if: false # Disable for now
name: Windows x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20.x"
# TODO: Make a fork of this fork to update to 0.4.7
- name: Install gopy
run: |
cd $env:TEMP
git clone https://github.com/bjia56/gopy
cd gopy
git checkout v0.4.5+bjia56.v1
go install -v
gopy
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
with:
package-dir: .
env:
CIBW_BUILD: "cp3*"
CIBW_SKIP: "cp36-* cp37-*"
CIBW_ARCHS: "native"
CIBW_ENVIRONMENT: >
GOARCH=amd64
CGO_ENABLED=1
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
all_builds_passed:
needs:
- build_macos
- build_linux_x86_64
- build_linux_arm64
- build_linux_armv7l
#- build_windows
runs-on: ubuntu-latest
steps:
- run: |
echo "All builds passed!"