-
Notifications
You must be signed in to change notification settings - Fork 7
298 lines (286 loc) · 10.5 KB
/
pypecos.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: PyPECOS
on:
push:
branches:
- master
- development
tags:
- "*"
pull_request:
branches:
- master
- development
permissions:
contents: read
jobs:
linux-pypecos-rslib:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
target: [x86_64, x86, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup pre-commit
run: |
python -m pip install pre-commit
pre-commit install
- name: Run pre-commit on all files
run: pre-commit run --all-files
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter python${{ matrix.python-version }} --manifest-path ./python/pypecos-rslib/Cargo.toml
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: pypecos-rslib-wheels-linux-${{ matrix.python-version }}-${{ matrix.target }}
path: dist
- name: List wheel files in dist
if: ${{ always() }}
run: |
echo "Listing generated wheel files..."
ls -lah dist/
- name: pytest
if: ${{ startsWith(matrix.target, 'x86_64') }}
shell: bash
run: |
pip install --upgrade pip setuptools
pip install pytest-cov
set -e
PYTHON_VER=$(python -c "import sys; print(''.join(map(str, sys.version_info[:2])))")
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER}-*.whl)
pip install "${WHEEL_FILE}" --force-reinstall
pip install pytest
cd ./python/pypecos-rslib && pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
- name: pytest aarch64
if: ${{ !startsWith(matrix.target, 'x86') && !startsWith(matrix.target, 'ppc64')}}
uses: uraimo/[email protected]
with:
arch: ${{ matrix.target }}
distro: ubuntu_latest
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y software-properties-common curl
add-apt-repository ppa:deadsnakes/ppa -y
apt-get update
apt-get install -y --no-install-recommends build-essential cmake
apt-get install -y python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-distutils
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.python-version }} get-pip.py
python${{ matrix.python-version }} -m pip install -U pip pytest setuptools
run: |
PYTHON_BIN=python${{ matrix.python-version }}
PYTHON_VER=${{ matrix.python-version }}
PYTHON_VER_NO_DOT="${PYTHON_VER//./}" # Replace dot with nothing
$PYTHON_BIN -m pip install --upgrade pip setuptools
$PYTHON_BIN -m pip install pytest-cov
set -e
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER_NO_DOT}-*.whl)
$PYTHON_BIN -m pip install "${WHEEL_FILE}" --force-reinstall --only-binary :all:
cd ./python/pypecos-rslib && $PYTHON_BIN -m pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
windows-pypecos-rslib:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
target: [x64,
# x86
]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.target }}
- name: Setup pre-commit
run: |
python -m pip install pre-commit
pre-commit install
- name: Run pre-commit on all files
run: pre-commit run --all-files
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter python${{ matrix.python-version }} --manifest-path ./python/pypecos-rslib/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: pypecos-rslib-wheels-windows-${{ matrix.python-version }}-${{ matrix.target }}
path: dist
- name: pytest
if: ${{ !startsWith(matrix.target, 'aarch64') }}
shell: bash
run: |
pip install --upgrade pip setuptools
pip install pytest-cov
set -e
PYTHON_VER=$(python -c "import sys; print(''.join(map(str, sys.version_info[:2])))")
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER}-*.whl)
pip install "${WHEEL_FILE}" --force-reinstall
pip install pytest
cd ./python/pypecos-rslib && pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
macos-pypecos-rslib:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup pre-commit
run: |
python -m pip install pre-commit
pre-commit install
- name: Run pre-commit on all files
run: pre-commit run --all-files
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter python${{ matrix.python-version }} --manifest-path ./python/pypecos-rslib/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: pypecos-rslib-wheels-macos-${{ matrix.python-version }}-${{ matrix.target }}
path: dist
- name: pytest
if: ${{ !startsWith(matrix.target, 'aarch64') }}
shell: bash
run: |
pip install --upgrade pip setuptools
pip install pytest-cov
set -e
PYTHON_VER=$(python -c "import sys; print(''.join(map(str, sys.version_info[:2])))")
WHEEL_FILE=$(ls dist/pypecos_rslib-*-cp${PYTHON_VER}-*.whl)
pip install "${WHEEL_FILE}" --force-reinstall
pip install pytest
cd ./python/pypecos-rslib && pytest --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
sdist-pypecos-rslib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup pre-commit
run: |
python -m pip install pre-commit
pre-commit install
- name: Run pre-commit on all files
run: pre-commit run --all-files
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path ./python/pypecos-rslib/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: pypecos-rslib-sdist
path: dist
# pypecos building/testing (Pure Python)
build-pypecos:
needs: [
linux-pypecos-rslib,
windows-pypecos-rslib,
macos-pypecos-rslib,
sdist-pypecos-rslib
]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install -r python/pypecos/requirements.txt
- name: Pre-commit checks
run: |
python -m pip install pre-commit
pre-commit run --all-files
- name: Test with pytest
run: |
pip install pytest-cov
pip install ./python/pypecos
pytest ./python/pypecos/tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
- name: Test optional dependencies with pytest
run: |
pip install pytest-cov
pip install ./python/pypecos[all]
pytest ./python/pypecos/tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html -m optional_dependency
sdist-pypecos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup pre-commit
run: |
python -m pip install pre-commit
pre-commit install
- name: Run pre-commit on all files
run: pre-commit run --all-files
- name: Build sdist and wheel
run: |
python -m pip install -U build wheel
python -m build --sdist --wheel --outdir dist ./python/pypecos/
- name: Upload sdist and wheel
uses: actions/upload-artifact@v4
with:
name: pypecos-distributions
path: dist/*
release-pypecos-rslib:
name: Release PyPECOS-rslib
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux-pypecos-rslib, windows-pypecos-rslib, macos-pypecos-rslib, sdist-pypecos-rslib]
steps:
- uses: actions/download-artifact@v4
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing *
release-pypecos:
name: Release PyPECOS
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [ build-pypecos, sdist-pypecos ]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: pypecos-distributions
- name: Publish to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ./dist