-
Notifications
You must be signed in to change notification settings - Fork 50
182 lines (157 loc) · 6.17 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Build wheels
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
# Trigger on pushes to the mainline branches and version tags. This prevents building commits
# twice when the pull request source branch is in the same repository.
push:
branches:
- "main"
- "next"
tags:
- "v*"
pull_request:
types: [opened, labeled, reopened, synchronize]
# Trigger on request.
workflow_dispatch:
env:
UV_VERSION: 0.2.2
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
build_wheels:
name: Build wheels [${{ matrix.python.version }}, ${{ matrix.os.base }}-${{ matrix.os.arch }}]
runs-on: ${{ matrix.os.base }}-${{ matrix.os.version }}
if: ${{ contains(github.event.pull_request.labels.*.name, 'build_wheels') || github.event_name != 'pull_request' }}
strategy:
fail-fast: false
matrix:
os:
- base: ubuntu
version: latest
arch: 'x86_64'
# - base: windows
# version: latest
# arch: 'amd64'
- base: macos
version: 14
arch: 'arm64'
- base: macos
version: 13
arch: 'x86_64'
python:
# Pinned versions installed in CIBW_TEST_REQIURES are kept. Those defined installed in
# CIBW_BEFORE_TEST are often upgraded when the wheel is installed. This means we can't
# store the pinned requirements in a requirements file.
# Generate these version sets with commands like this:
# echo -e "numpy==1.21.6\nscipy\ngsd\nmatplotlib\nsympy" | uv pip compile --python-platform linux --python-version 3.9 --only-binary :all: - --resolution=lowest --no-deps
- version: 'cp39'
oldest_numpy: '1.22.4'
oldest_scipy: '1.7.3'
oldest_gsd: '2.5.0'
oldest_matplotlib: '3.5.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp310'
oldest_numpy: '1.22.4'
oldest_scipy: '1.7.3'
oldest_gsd: '2.7.0'
oldest_matplotlib: '3.5.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp311'
oldest_numpy: '1.23.2'
oldest_scipy: '1.9.2'
oldest_gsd: '2.7.0'
oldest_matplotlib: '3.6.0'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
- version: 'cp312'
oldest_numpy: '1.26.2'
oldest_scipy: '1.11.2'
oldest_gsd: '3.2.0'
oldest_matplotlib: '3.7.3'
oldest_pytest: '8.2.1'
oldest_sympy: '1.10'
steps:
- uses: actions/[email protected]
with:
submodules: "recursive"
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "${{ matrix.python.version }}-*"
CIBW_SKIP: "{pp*,*-musllinux_*}"
# Build only on 64-bit architectures.
CIBW_ARCHS: auto64
# Configure environment variables.
CIBW_ENVIRONMENT_LINUX: "CMAKE_PREFIX_PATH=/project/tbb LD_LIBRARY_PATH=/project/tbb/lib/intel64/gcc4.8:$LD_LIBRARY_PATH"
CIBW_ENVIRONMENT_MACOS: "CMAKE_PREFIX_PATH=/Users/runner/work/freud/freud/tbb:/Users/runner/work/tbb-install LD_LIBRARY_PATH=/Users/runner/work/freud/freud/tbb/lib/intel64/gcc4.8:$LD_LIBRARY_PATH"
MACOSX_DEPLOYMENT_TARGET: "10.14"
# Set up TBB.
CIBW_BEFORE_BUILD_LINUX: "source .github/workflows/cibuildwheel-before-build.sh {package} linux"
CIBW_BEFORE_BUILD_MACOS: "source .github/workflows/cibuildwheel-before-build.sh {package} macos"
CIBW_BEFORE_BUILD_WINDOWS: "powershell .github/workflows/cibuildwheel-before-build.ps1 {package}"
# Test the wheels.
CIBW_TEST_REQUIRES: >
pytest==${{ matrix.python.oldest_pytest }}
sympy==${{ matrix.python.oldest_sympy }}
numpy==${{ matrix.python.oldest_numpy }}
scipy==${{ matrix.python.oldest_scipy }}
gsd==${{ matrix.python.oldest_gsd }}
matplotlib==${{ matrix.python.oldest_matplotlib }}
CIBW_TEST_COMMAND: "cd {package}/tests && pytest . -v --log-level=DEBUG"
- uses: actions/[email protected]
with:
name: dist-${{ matrix.os.base }}-${{ matrix.os.version }}-${{ matrix.python.version }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'build_wheels') || github.event_name != 'pull_request' }}
steps:
- uses: actions/[email protected]
with:
submodules: "recursive"
- uses: actions/[email protected]
name: Install Python
with:
python-version: '3.12'
- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash
- name: Install build
run: 'uv pip install -r .github/requirements-build-sdist.txt --only-binary :all: --system --reinstall'
- name: Build sdist
run: python -m build --sdist --outdir dist/ .
- uses: actions/[email protected]
with:
name: dist-sdist
path: dist/*.tar.gz
upload_pypi:
name: Publish [PyPI]
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
concurrency: upload
if: ${{ contains(github.event.pull_request.labels.*.name, 'build_wheels') || github.event_name != 'pull_request' }}
steps:
- name: Download artifacts
uses: actions/[email protected]
with:
merge-multiple: 'true'
pattern: dist-*
path: dist
- name: Check files
run: ls -lR dist
- name: Upload to PyPI
# upload to PyPI on every tag starting with 'v'
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Slack notification
if: startsWith(github.ref, 'refs/tags/v') || failure()
uses: act10ns/[email protected]
with:
status: ${{ job.status }}
channel: '#dev-freud'