forked from cython/cython
-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (140 loc) · 5.4 KB
/
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
# Workflow to build wheels for upload to PyPI.
#
# In an attempt to save CI resources, wheel builds do
# not run on each push but only weekly and for releases.
# Wheel builds can be triggered from the Actions page
# (if you have the perms) on a commit to master.
#
# Alternatively, if you would like to trigger wheel builds
# on a pull request, the labels that trigger builds are:
# - Build System
name: Wheel Builder
on:
release:
types: [created]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "42 1 * * 4"
pull_request:
types: [labeled, opened, synchronize, reopened]
paths:
#- Cython/Build/**
- .github/workflows/wheels.yml
- MANIFEST.in
- setup.*
push:
paths:
#- Cython/Build/**
- .github/workflows/wheels.yml
- MANIFEST.in
- setup.*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: write # to create GitHub release (softprops/action-gh-release)
jobs:
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}
if: >-
github.event_name == 'release' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Build System'))
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, manylinux_aarch64]
- [ubuntu-20.04, manylinux_i686]
- [ubuntu-20.04, musllinux_x86_64]
- [ubuntu-20.04, musllinux_aarch64]
- [macos-12, macosx_*]
- [windows-2019, win_amd64]
- [windows-2019, win32]
python: ["cp36", "cp37", "cp38", "cp39", "cp310", "cp311", "cp312", "cp313"] # Note: Wheels not needed for PyPy
steps:
- name: Checkout Cython
uses: actions/[email protected]
- name: Set up QEMU
if: contains(matrix.buildplat[1], '_aarch64')
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
# TODO: Build Cython with the compile-all flag?
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_PRERELEASE_PYTHONS: True
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ENVIRONMENT: CFLAGS='-O3 -g0 -mtune=generic -pipe -fPIC' LDFLAGS='-fPIC'
# TODO: Cython tests take a long time to complete
# consider running a subset in the future?
#CIBW_TEST_COMMAND: python {project}/runtests.py -vv --no-refnanny
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: wheelhouse/*.whl
prerelease: >-
${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b')
|| contains(github.ref_name, 'rc') || contains(github.ref_name, 'dev') }}
- uses: actions/[email protected]
with:
name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
build_sdist_pure_wheel:
name: Build sdist and pure wheel
if: >-
github.event_name == 'release' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Build System'))
runs-on: ubuntu-latest
steps:
- name: Checkout Cython
uses: actions/[email protected]
# Used to push the built wheels
- uses: actions/[email protected]
with:
# Build sdist on lowest supported Python
python-version: '3.8'
- name: Build sdist
run: |
pip install --upgrade wheel setuptools
python setup.py sdist
python setup.py bdist_wheel --no-cython-compile --universal
- uses: actions/[email protected]
with:
name: sdist
path: ./dist/*.tar.gz
- uses: actions/[email protected]
with:
name: pure-wheel
path: ./dist/*.whl
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/*.tar.gz
dist/*-none-any.whl
prerelease: >-
${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b')
|| contains(github.ref_name, 'rc') || contains(github.ref_name, 'dev') }}