-
Notifications
You must be signed in to change notification settings - Fork 22
425 lines (340 loc) · 14.3 KB
/
conda-package.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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
name: Conda package
on:
push:
branches:
- master
pull_request:
permissions: read-all
env:
PACKAGE_NAME: dpnp
# Follow oneAPI installation instruction for conda, since intel channel is not longer available
# CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels'
CONDA_BUILD_VERSION: '24.11.1'
CONDA_INDEX_VERSION: '0.5.0'
RERUN_TESTS_ON_FAILURE: 'true'
RUN_TESTS_MAX_ATTEMPTS: 2
TEST_ENV_NAME: 'test'
VER_JSON_NAME: 'version.json'
VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); "
VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
jobs:
build:
name: Build ['${{ matrix.os }}', python='${{ matrix.python }}']
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-22.04, windows-2019]
permissions:
# Needed to cancel any previous runs that are not completed for a given workflow
actions: write
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
continue-on-error: true
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout DPNP repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: 'build'
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
- name: Disable speed limit check in mamba
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
- name: Store conda paths as envs
shell: bash -el {0}
run: |
echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\\\" '/' >> $GITHUB_ENV
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> $GITHUB_ENV
- name: Install conda-build
run: mamba install conda-build=${{ env.CONDA_BUILD_VERSION}}
- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.CHANNELS }} conda-recipe
env:
MAX_BUILD_CMPL_MKL_VERSION: '2025.1a0'
- name: Upload artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2
- name: Upload wheels artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
test_linux:
name: Test ['ubuntu-latest', python='${{ matrix.python }}']
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
continue-on-error: true
env:
channel-path: '${{ github.workspace }}/channel/'
pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/'
extracted-pkg-path: '${{ github.workspace }}/pkg/'
ver-json-path: '${{ github.workspace }}/version.json'
steps:
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.pkg-path-in-channel }}
- name: Extract package archive
run: |
mkdir -p ${{ env.extracted-pkg-path }}
tar -xvf ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.tar.bz2 -C ${{ env.extracted-pkg-path }}
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: ${{ env.TEST_ENV_NAME }}
- name: Install conda-index
run: mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
- name: Create conda channel
run: |
python -m conda_index ${{ env.channel-path }}
- name: Test conda channel
run: |
mamba search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
cat ${{ env.ver-json-path }}
- name: Get package version
run: |
export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}")
echo PACKAGE_VERSION=${PACKAGE_VERSION}
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Install dpnp
run: mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
MAMBA_NO_LOW_SPEED_LIMIT: 1
- name: List installed packages
run: mamba list
- name: Smoke test
run: |
python -c "import dpnp, dpctl; dpctl.lsplatform()"
python -c "import dpnp; print(dpnp.__version__)"
- name: Run tests
if: env.RERUN_TESTS_ON_FAILURE != 'true'
run: |
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
- name: Run tests
if: env.RERUN_TESTS_ON_FAILURE == 'true'
id: run_tests_linux
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 10
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
retry_on: any
command: |
. $CONDA/etc/profile.d/conda.sh
. $CONDA/etc/profile.d/mamba.sh
mamba activate ${{ env.TEST_ENV_NAME }}
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
test_windows:
name: Test ['windows-2019', python='${{ matrix.python }}']
needs: build
runs-on: windows-2019
defaults:
run:
shell: cmd /C CALL {0}
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
continue-on-error: true
env:
channel-path: '${{ github.workspace }}\channel\'
pkg-path-in-channel: '${{ github.workspace }}\channel\win-64\'
extracted-pkg-path: '${{ github.workspace }}\pkg'
ver-json-path: '${{ github.workspace }}\version.json'
workdir: '${{ github.workspace }}'
steps:
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.pkg-path-in-channel }}
- name: Extract package archive
run: |
@echo on
mkdir -p ${{ env.extracted-pkg-path }}
set SEARCH_SCRIPT="DIR ${{ env.pkg-path-in-channel }} /s/b | FINDSTR /r "dpnp-.*\.tar\.bz2""
FOR /F "tokens=* USEBACKQ" %%F IN (`%SEARCH_SCRIPT%`) DO (
SET FULL_PACKAGE_PATH=%%F
)
echo FULL_PACKAGE_PATH: %FULL_PACKAGE_PATH%
python -c "import shutil; shutil.unpack_archive(r\"%FULL_PACKAGE_PATH%\", extract_dir=r\"${{ env.extracted-pkg-path }}\")"
dir ${{ env.extracted-pkg-path }}
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: ${{ env.TEST_ENV_NAME }}
- name: Store conda paths as envs
run: |
@echo on
(echo CONDA_LIB_PATH=%CONDA_PREFIX%\Library\lib\) >> %GITHUB_ENV%
(echo CONDA_LIB_BIN_PATH=%CONDA_PREFIX%\Library\bin\) >> %GITHUB_ENV%
- name: Install conda-index
run: mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
- name: Create conda channel
run: |
@echo on
python -m conda_index ${{ env.channel-path }}
- name: Test conda channel
run: |
@echo on
mamba search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
- name: Dump version.json
run: more ${{ env.ver-json-path }}
- name: Get package version
run: |
@echo on
set "SCRIPT=${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}"
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
set PACKAGE_VERSION=%%F
)
echo PACKAGE_VERSION: %PACKAGE_VERSION%
(echo PACKAGE_VERSION=%PACKAGE_VERSION%) >> %GITHUB_ENV%
- name: Install dpnp
run: |
@echo on
mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
env:
TEST_CHANNELS: '-c ${{ env.channel-path }} ${{ env.CHANNELS }}'
MAMBA_NO_LOW_SPEED_LIMIT: 1
- name: List installed packages
run: mamba list
- name: Activate OCL CPU RT
shell: pwsh
run: |
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
if (Test-Path $script_path) {
&$script_path
} else {
Write-Warning "File $script_path was NOT found!"
}
# Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
$cl_cfg="$env:CONDA_PREFIX\Library\lib\cl.cfg"
Get-Content -Tail 5 -Path $cl_cfg
- name: Smoke test
run: |
python -c "import dpnp, dpctl; dpctl.lsplatform()"
python -c "import dpnp; print(dpnp.__version__)"
- name: Run tests
if: env.RERUN_TESTS_ON_FAILURE != 'true'
run: |
pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
- name: Run tests
if: env.RERUN_TESTS_ON_FAILURE == 'true'
id: run_tests_win
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 15
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
retry_on: any
command: |
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
upload:
name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}']
needs: [test_linux, test_windows]
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-22.04, windows-2019]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
continue-on-error: true
if: |
(github.repository == 'IntelPython/dpnp') &&
(github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
steps:
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Download wheels artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: 'upload'
- name: Install anaconda-client
run: mamba install anaconda-client
- name: Package version
shell: bash -el {0}
run: |
echo "PACKAGE_VERSION=$(basename ${{ env.PACKAGE_NAME }}-*.tar.bz2 | sed 's/^${{ env.PACKAGE_NAME }}-\([^-]*\).*/\1/')" >> $GITHUB_ENV
- name: Upload
run: |
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
- name: Upload wheels
run: |
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.whl --version ${{ env.PACKAGE_VERSION }}
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
cleanup_packages:
name: Clean up anaconda packages
needs: [upload]
runs-on: 'ubuntu-latest'
defaults:
run:
shell: bash -el {0}
steps:
- uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
run-post: 'false'
python-version: '3.12'
activate-environment: 'cleanup'
- name: Install anaconda-client
run: mamba install anaconda-client
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: IntelPython/devops-tools
fetch-depth: 0
- name: Cleanup old packages
run: |
python scripts/cleanup-old-packages.py \
--verbose --force --token ${{ secrets.ANACONDA_TOKEN }} \
--package dppy/${{ env.PACKAGE_NAME }} --label dev