This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
206 lines (199 loc) · 8.55 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Build and upload nightly wheels
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
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: "0 0 * * 0,3" # Every Sunday and Wednesday at midnight
env:
BUILD_COMMIT: "1.9.0" # or a specific version, e.g., 1.8.0
CIBW_BUILD_VERBOSITY: 2
CIBW_TEST_REQUIRES: "-r dipy/requirements/build.txt pytest"
CIBW_TEST_COMMAND: pytest --pyargs dipy
CIBW_CONFIG_SETTINGS: "compile-args=-v"
CIBW_TEST_SKIP: "*" # skip tests for all wheels
MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }}
SCIENTIFIC_PYTHON_NIGHTLY_WHEELS: ${{ secrets.SCIENTIFIC_PYTHON_NIGHTLY_WHEELS }}
SCIPY_WHEELS_NIGHTLY_ACCESS: ${{ secrets.SCIPY_WHEELS_NIGHTLY_ACCESS }}
permissions:
contents: read
concurrency:
group: build-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_linux_wheels:
name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
cibw_python: ["cp39-*", "cp310-*", "cp311-*", "cp312-*"]
cibw_manylinux: [manylinux2014]
cibw_arch: ["x86_64", "aarch64"]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.12"
- name: Setup Environment variables
shell: bash
run: |
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
- name: Set up QEMU
if: ${{ matrix.cibw_arch == 'aarch64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build the wheel
run: python -m cibuildwheel --output-dir dist dipy
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }}
CIBW_SKIP: "*-musllinux_*"
CIBW_TEST_SKIP: "*" # "*_aarch64"
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.cibw_manylinux }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.cibw_manylinux }}
CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}'
- name: Rename Python version
run: echo "PY_VERSION=$(echo ${{ matrix.cibw_python }} | cut -d- -f1)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ env.PY_VERSION }}-${{ matrix.cibw_manylinux }}-${{ matrix.cibw_arch }}
path: ./dist/*.whl
build_osx_wheels:
name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-latest]
cibw_python: ["cp39-*", "cp310-*", "cp311-*", "cp312-*"]
include:
- os: macos-latest
cibw_arch: x86_64
compiler_env: CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ LIBRARY_PATH=/usr/local/opt/llvm/lib:$LIBRARY_PATH
- os: macos-14
cibw_arch: arm64
compiler_env: CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++ LIBRARY_PATH=/opt/homebrew/opt/llvm/lib:$LIBRARY_PATH
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.12"
- name: Setup Environment variables
shell: bash
run: |
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build the wheel
run: python -m cibuildwheel --output-dir dist dipy
env:
CIBW_BEFORE_ALL_MACOS: "brew install llvm@17 libomp"
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
CIBW_TEST_SKIP: "*" # "*_aarch64 *-macosx_arm64"
CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}'
CIBW_ENVIRONMENT_MACOS: ${{ matrix.compiler_env }}
- name: Rename Python version
run: echo "PY_VERSION=$(echo ${{ matrix.cibw_python }} | cut -d- -f1)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ env.PY_VERSION }}-${{ matrix.cibw_arch }}
path: ./dist/*.whl
build_windows_wheels:
name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
cibw_python: ["cp39-*", "cp310-*", "cp311-*", "cp312-*"]
cibw_arch: ["AMD64"]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.12"
- name: Setup Environment variables
shell: bash
run: |
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build the wheel
run: python -m cibuildwheel --output-dir dist dipy
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
CIBW_CONFIG_SETTINGS: "setup-args=--vsenv compile-args=-v"
CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}'
- name: Rename Python version
shell: bash
run: echo "PY_VERSION=$(echo ${{ matrix.cibw_python }} | cut -d- -f1)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ env.PY_VERSION }}-${{ matrix.cibw_arch }}
path: ./dist/*.whl
upload_anaconda:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
name: Upload to Anaconda
needs: [build_linux_wheels, build_osx_wheels, build_windows_wheels]
if: ${{ always() }} && github.repository_owner == 'dipy' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
id: download
with:
pattern: wheels-*
path: ./dist
merge-multiple: true
- name: Setup Upload Variables
shell: bash
run: |
if [ "schedule" == "${{ github.event_name }}" ] || [ "push" == "${{ github.event_name }}" ]; then
echo "ANACONDA_UPLOAD=true" >> $GITHUB_ENV
else
echo "ANACONDA_UPLOAD=false" >> $GITHUB_ENV
fi
if [ "schedule" == "${{ github.event_name }}" ] || [ "master" == "$BUILD_COMMIT" ]; then
echo "ANACONDA_ORG=scipy-wheels-nightly" >> $GITHUB_ENV
echo "TOKEN=$SCIPY_WHEELS_NIGHTLY_ACCESS" >> $GITHUB_ENV
echo "LABEL=dev" >> $GITHUB_ENV
else
echo "ANACONDA_ORG=multibuild-wheels-staging" >> $GITHUB_ENV
echo "TOKEN=$MULTIBUILD_WHEELS_STAGING_ACCESS" >> $GITHUB_ENV
echo "LABEL=main" >> $GITHUB_ENV
fi
- name: Upload wheel
if : ${{ env.ANACONDA_UPLOAD == 'true' }}
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # 0.5.0 # scientific-python/upload-nightly-action@main
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{env.TOKEN}}
anaconda_nightly_upload_organization: ${{env.ANACONDA_ORG}}
anaconda_nightly_upload_labels: ${{env.LABEL}}