-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (144 loc) · 5.01 KB
/
publish.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
# Based on https://github.com/tuananh/py-event-ruler/blob/0129d15e17d0023863a4d0e0e25e5256988b5c5b/.github/workflows/publish.yml
on:
push:
branches:
- develop
- multi-platform-cibuildwheel
workflow_dispatch:
# on:
# # release:
# # types: [created]
# push:
# tags:
# - '*'
jobs:
build_macos:
# if: false
name: MacOS ${{ matrix.os_version }} 3${{ matrix.python3_version }} ${{ matrix.arch_cibw_go[0] }}
strategy:
fail-fast: false
matrix:
os_version: [ 12 ]
python3_version: [ 11 ]
arch_cibw_go:
- [ "x86_64", "amd64" ]
- [ "arm64", "arm64" ]
runs-on: macos-${{ matrix.os_version }}
steps:
- uses: actions/checkout@v3
- name: set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22.x"
- name: copy setup.py
run: cp setup_ci.py setup.py
- name: install gopy
run: go install github.com/go-python/[email protected]
- name: install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: install python 3.${{ matrix.python3_version }}
run: |
brew install python@3.${{ matrix.python3_version }}
ln -s /usr/local/opt/python@3.${{ matrix.python3_version }}/bin/python3.${{ matrix.python3_version }} /usr/local/bin/python_for_build
/usr/local/bin/python_for_build --version
- name: install cibuildwheel and pybindgen
run: /usr/local/bin/python_for_build -m pip install cibuildwheel==2.19.2 pybindgen
- name: build wheels
run: /usr/local/bin/python_for_build -m cibuildwheel --output-dir wheelhouse
env:
CGO_ENABLED: 1 # build fails for arm if unset
CIBW_ARCHS: ${{ matrix.arch_cibw_go[0] }}
PYTHON_BINARY_PATH: /usr/local/bin/python_for_build
CIBW_BUILD: "cp3${{ matrix.python3_version }}-*"
CIBW_ENVIRONMENT: >
PATH=$PATH:/usr/local/go/bin
GOARCH=${{ matrix.arch_cibw_go[1] }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-macos${{ matrix.os_version }}-py3${{ matrix.python3_version }}-${{ matrix.arch_cibw_go[0] }}
path: ./wheelhouse/*.whl
build_linux_x86_64:
# if: false
name: Linux 311 x86_64
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: copy setup.py
run: cp setup_ci.py setup.py
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "cp3*_x86_64"
CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-* cp310-* *-musllinux_x86_64"
CIBW_ARCHS: "native"
CIBW_ENVIRONMENT: >
PATH=$PATH:/usr/local/go/bin
CIBW_BEFORE_ALL_LINUX: |
curl -o go.tar.gz https://dl.google.com/go/go1.22.5.linux-amd64.tar.gz
tar -C /usr/local -xzf go.tar.gz
go install github.com/go-python/[email protected]
go install golang.org/x/tools/cmd/goimports@latest
- name: Upload atifacts
uses: actions/upload-artifact@v4
with:
name: wheels-linux-amd64
path: ./wheelhouse/*.whl
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-linux-arm
path: /tmp/output/*.whl
# build_windows:
# if: false # not working
# name: Windows 310,311 x86_64
# runs-on: windows-2019
# steps:
# - uses: actions/checkout@v3
# - name: copy setup.py
# run: cp setup_ci.py setup.py
# - name: set up Go
# uses: actions/setup-go@v3
# with:
# go-version: "1.22.x"
# - name: install gopy
# run: go install github.com/go-python/[email protected]
# - name: install goimports
# run: go install golang.org/x/tools/cmd/goimports@latest
# - name: Build wheels
# uses: pypa/[email protected]
# env:
# # CGO_ENABLED: 1
# CIBW_BUILD: "cp3*"
# CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-*"
# CIBW_ARCHS: "native"
# CIBW_ENVIRONMENT: >
# GOARCH=amd64
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: wheels-windows-amd64
# path: ./wheelhouse/*.whl
publish_pypi:
if: startsWith(github.ref, 'refs/tags/')
name: Publish PyPI
needs: [ build_linux_x86_64, build_linux_arm, build_macos ]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ohpygossh
steps:
- uses: actions/download-artifact@v4
- name: Collect all wheels
run: |
ls -R
mkdir dist
for f in $(find . -type f -name '*.whl'); do mv ${f} dist; done;
ls -R dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist
password: ${{ secrets.PYPI_API_TOKEN }}
print-hash: true