-
Notifications
You must be signed in to change notification settings - Fork 34
189 lines (167 loc) · 5.47 KB
/
build.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
name: build
on:
pull_request:
push:
branches:
- master
tags:
- '*'
jobs:
build_openmp:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.9, "3.10", "3.11" ]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
miniforge-version: latest
channels: conda-forge,anaconda
- name: Install dependencies
run: |
conda install scipy numpy pytest 'setuptools<=60'
- name: Test
run: |
python legacy_setup.py install --scs --openmp
pytest
rm -rf build/
build_mkl:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
# macos-13 runners have intel chips. macos-14 and above
# runners have Apple silicon chips.
os: [ ubuntu-latest, macos-13, windows-latest ]
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13"]
link_mkl: [true]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
LINK_MKL: ${{ matrix.link_mkl }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set Additional Envs
shell: bash
run: |
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
miniforge-version: latest
channels: conda-forge,anaconda
- name: Install dependencies
run: |
if [[ "$LINK_MKL" == "true" ]]; then
BLAS_PKGS="blas-devel=*=*mkl"
else
BLAS_PKGS="blas-devel=*=*openblas"
fi
if [[ "$PYTHON_VERSION" == "3.9" ]]; then
conda install scipy=1.5 numpy=1.19 pytest $BLAS_PKGS pkg-config
elif [[ "$PYTHON_VERSION" == "3.10" ]]; then
conda install scipy=1.7 numpy=1.21 pytest $BLAS_PKGS pkg-config
elif [[ "$PYTHON_VERSION" == "3.11" ]]; then
conda install scipy=1.9.3 numpy=1.23.4 pytest $BLAS_PKGS pkg-config
elif [[ "$PYTHON_VERSION" == "3.12" || "$PYTHON_VERSION" == "3.13" ]]; then
conda install scipy numpy pytest $BLAS_PKGS pkg-config
fi
- name: Build
run: |
python -c "import numpy as np; print('NUMPY BLAS INFOS'); print(np.show_config())"
if [[ "$LINK_MKL" == "true" ]]; then
python -m pip install --verbose -Csetup-args=-Dlink_mkl=true .
else
python -m pip install --verbose .
fi
- name: Test
run: |
pytest
rm -rf build/
# from here to end it's a copy-paste, with few changes, of
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, macos-14, windows-latest, macos-13]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU for aarch64 compilation on Linux
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Install conda on Windows
if: runner.os == 'Windows'
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
channels: conda-forge, anaconda
- name: Install openblas from conda on Windows
if: runner.os == 'Windows'
run: conda install -y openblas pkgconfig
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build sdist
run: pipx run build --sdist -Csetup-args=-Dsdist_mode=true
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
# We can also upload always, with skip-existing: true, below
# We upload on every push event (only master, above) that is a new tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# Only run this step on GH release
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: false # Fail loudly for duplicates.
# To test:
# with:
# repository-url: https://test.pypi.org/legacy/