-
Notifications
You must be signed in to change notification settings - Fork 8
159 lines (136 loc) Β· 4.01 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
name: Build wheels
on:
pull_request:
push:
tags:
- "v*"
jobs:
# Build the source distribution for PyPI
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build sdist
run: |
python3.10 -m pip install --upgrade wheel
python3.10 setup.py sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
# Build binary distributions for PyPI
build_wheels:
name: Build on ${{ matrix.os }} for ${{matrix.cibw_python}} ${{matrix.cibw_arch}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Windows isn't working right now: https://github.com/caketop/python-starlark-go/issues/4
os: [ubuntu-latest, macos-latest]
cibw_python: ["cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*"]
cibw_arch: ["i686", "x86_64", "aarch64", "arm64"]
include:
- cibw_arch: arm64
goarch: arm64
- cibw_arch: aarch64
goarch: arm64
- cibw_arch: x86_64
goarch: amd64
exclude:
- os: ubuntu-latest
cibw_arch: arm64
- os: macos-latest
cibw_arch: i686
- os: macos-latest
cibw_arch: aarch64
- os: macos-latest
cibw_python: "cp37-*"
cibw_arch: arm64
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
if: runner.os != 'Linux'
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/[email protected]
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 1
- uses: actions/upload-artifact@v3
with:
path: wheelhouse/starlark_go-*.whl
# Create a GitHub release
github_release:
name: Create GitHub release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: "βοΈ Generate release changelog"
id: changelog
uses: heinrichreimer/[email protected]
with:
filterByMilestone: false
onlyLastTag: true
pullRequests: true
prWoLabels: true
token: ${{ secrets.GITHUB_TOKEN }}
verbose: true
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}
files: dist/**/*
# Test PyPI
test_pypi_publish:
name: Test publishing to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
# Publish to PyPI
pypi_publish:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}