-
Notifications
You must be signed in to change notification settings - Fork 50
180 lines (151 loc) · 5.23 KB
/
main.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
# Automatically build binary wheels and source packages.
name: cibuildwheel
# Build on every branch push with tag.
on:
push:
tags:
- '*'
env:
PYTHON_VER: '3.10' # Python to run test/cibuildwheel
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*
CIBW_TEST_COMMAND: python -m unittest regex.test_regex
jobs:
# Run test on Ubuntu/macOS/Windows for every commit.
run_test:
name: Run test on ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VER }}
- name: Run test
run: |
python -m pip install -vv .
python -m unittest -v regex.test_regex
# Build Linux/macOS/Windows wheels.
build_wheels:
name: Build ${{ matrix.platform }} wheels
if: github.event_name == 'push'
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
env:
# macOS archs
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VER }}
- name: Install cibuildwheel & build wheels
run: |
python -m pip install -U cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: regex-files
path: wheelhouse/*.whl
# I cannot get this to work!
# - name: Create GitHub release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref }}
# release_name: regex ${{ github.ref }}
# Build source distribution & manylinux1_x86_64 wheels
# These two jobs build:
# 1, build_wheels (above): manylinux1_i686 / manylinux2014_x86_64
# 2, build_in_manylinux2010 (this): manylinux1_x86_64
# manylinux2014_x86_64 wheels use a new memcpy() function
# (memcpy@GLIBC_2.14), so the wheels are not compatible with
# manylinux1_x86_64 environment. In order to be compatible as
# much as possible, this job builds manylinux1_x86_64 wheels.
build_in_manylinux2010:
name: Build in manylinux2010 environment
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
# Generate manylinux1_x86_64 wheels.
# tag pip CPython with the pip glibc
# manylinux1 >=8.1.0 3.5.2+, 3.6.0+ 2.5 (2006-09-29)
# manylinux2010 >=19.0 3.7.3+, 3.8.0+ 2.12 (2010-05-03)
# manylinux2014 >=19.3 3.7.8+, 3.8.4+, 3.9.0+ 2.17 (2012-12-25)
# manylinux_x_y >=20.3 3.8.10+, 3.9.5+, 3.10.0+ x.y
# manylinux2010 images EOL on 2022-08-01, it doesn't support cp311.
CIBW_BUILD: cp38-* cp39-* cp310-*
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
CIBW_ARCHS_LINUX: x86_64
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VER }}
- name: Build source distribution & wheels
run: |
python setup.py sdist --formats=gztar
python -m pip install -U cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: Upload source distribution
uses: actions/upload-artifact@v3
with:
name: regex-files
path: dist/*.tar.gz
- name: Upload manylinux1_x86_64 wheels
uses: actions/upload-artifact@v3
with:
name: regex-files
path: wheelhouse/*.whl
# Build and upload aarch64/ppc64le/s390x wheels.
build_arch_wheels:
name: Build ${{ matrix.arch }} Linux wheels
if: github.event_name == 'push'
runs-on: ubuntu-latest
strategy:
matrix:
arch: [aarch64, ppc64le, s390x]
# Building in QEMU is very slow, so parallelize the tasks.
skip_image: ["*musllinux*", "*manylinux*"]
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: ${{ matrix.skip_image }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VER }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install cibuildwheel & build wheels
run: |
python -m pip install -U cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: Upload ${{ matrix.arch }} wheels
uses: actions/upload-artifact@v3
with:
name: regex-files
path: wheelhouse/*.whl
# Upload to PyPI
upload_pypi:
name: Publish to PyPI
needs: [build_wheels, build_in_manylinux2010, build_arch_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: regex-files
path: dist
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip_existing: true
verbose: true
print_hash: true