-
Notifications
You must be signed in to change notification settings - Fork 37
717 lines (658 loc) · 28.1 KB
/
conda-package.yml
File metadata and controls
717 lines (658 loc) · 28.1 KB
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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
name: Conda package
on:
push:
branches:
- master
pull_request:
permissions: read-all
env:
PACKAGE_NAME: dpctl
MODULE_NAME: dpctl
TEST_ENV_NAME: test_dpctl
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['dpctl'][0];"
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
VER_SCRIPT3: "print(' '.join(map(lambda s: chr(34) + s + chr(34), [comp for comp in d['depends'] if 'dpcpp' in comp][1:])))"
INTEL_CHANNEL: "https://software.repos.intel.com/python/conda/"
CONDA_BUILD_VERSION: 26.3.0
jobs:
build_linux:
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
CACHE_NUMBER: 3 # Increase to reset cache
with:
path: ~/.conda/pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Add conda to system path
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
- name: Update conda
run: |
conda update -n base --all
- name: Install conda-build
run: |
conda install -n base conda-build=${{ env.CONDA_BUILD_VERSION }} -c conda-forge --override-channels
- name: Show Conda info
run: |
conda info --all
- name: List base environment packages
run: |
conda list -n base
- name: Store conda paths as envs
shell: bash -l {0}
run: |
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> "$GITHUB_ENV"
- name: Build conda package
run: |
# use bootstrap channel to pull NumPy linked with OpenBLAS
conda build --no-test --python ${{ matrix.python }} --numpy 2.0 -c conda-forge --override-channels conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda
- name: Upload wheels artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
build_windows:
runs-on: windows-latest
timeout-minutes: 150
defaults:
run:
shell: cmd /C CALL {0}
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
auto-update-conda: true
miniforge-version: latest
activate-environment: build
channels: conda-forge
python-version: ${{ matrix.python }}
conda-build-version: ${{ env.CONDA_BUILD_VERSION }}
- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
CACHE_NUMBER: 3 # Increase to reset cache
with:
path: /home/runner/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Store conda paths as envs
shell: bash -l {0}
run: |
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> "$GITHUB_ENV"
- name: Show Conda info
run: |
conda info --all
- name: List base environment packages
run: |
conda list -n base
- name: Build conda package
env:
OVERRIDE_INTEL_IPO: 1 # IPO requires more resources that GH actions VM provides
run: |
conda build --no-test --python ${{ matrix.python }} --numpy 2.0 -c conda-forge --override-channels conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
- name: Upload wheels artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
test_linux:
needs: build_linux
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
experimental: [false]
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Construct channels line
run: |
echo "CHANNELS=-c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> "$GITHUB_ENV"
- name: Display channels line
run: |
echo "${{ env.CHANNELS }}"
- name: Download artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Add conda to system path
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
- name: Update conda
run: |
conda update -n base --all
- name: Install conda-index
run: |
conda install -n base conda-index -c conda-forge --override-channels
- name: Show Conda info
run: |
conda info --all
- name: List base environment packages
run: |
conda list -n base
- name: Create conda channel
run: |
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
conda index "$GITHUB_WORKSPACE/channel" || exit 1
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64" || exit 1
conda index "$GITHUB_WORKSPACE/channel" || exit 1
# Test channel
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json"
cat ver.json
- name: Collect dependencies
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export CHANNELS
PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
export PACKAGE_VERSION
# shellcheck disable=SC2086
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
cat lockfile
- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
CACHE_NUMBER: 3 # Increase to reset cache
with:
path: ~/.conda/pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Install dpctl
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export CHANNELS
TEST_DEPENDENCIES="pytest pytest-cov cython setuptools"
export TEST_DEPENDENCIES
PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
export PACKAGE_VERSION
# shellcheck disable=SC2086
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} $TEST_DEPENDENCIES python=${{ matrix.python }} $CHANNELS
# Test installed packages
conda list -n "${{ env.TEST_ENV_NAME }}"
- name: Smoke test
run: |
. "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.TEST_ENV_NAME }}"
python -c "import dpctl; dpctl.lsplatform(verbosity=2)"
- name: Create test temp dir
# create temporary empty folder to runs tests from
# https://github.com/pytest-dev/pytest/issues/11904
run: mkdir -p "${GITHUB_WORKSPACE}/test_tmp"
- name: Run tests
working-directory: ${{ github.workspace }}/test_tmp
env:
SYCL_CACHE_PERSISTENT: 1
run: |
. "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.TEST_ENV_NAME }}"
python -m pytest -v --pyargs "${{ env.MODULE_NAME }}"
test_windows:
needs: build_windows
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
defaults:
run:
shell: cmd /C CALL {0}
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
experimental: [false]
runner: [windows-latest]
continue-on-error: ${{ matrix.experimental }}
env:
workdir: '${{ github.workspace }}'
steps:
- name: Construct channels line
shell: pwsh
run: |
echo "CHANNELS=-c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> $env:GITHUB_ENV
- name: Display channels line
run: |
echo "${{ env.CHANNELS }}"
- name: Download artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
auto-update-conda: true
miniforge-version: latest
channels: conda-forge
activate-environment: ${{ env.TEST_ENV_NAME }}
python-version: ${{ matrix.python }}
- name: Install conda-index
run: |
conda install -n base conda-index
- name: Show Conda info
run: |
conda info --all
- name: List base environment packages
run: |
conda list -n base
- name: Create conda channel with the artifact bit
shell: cmd /C CALL {0}
run: |
@echo on
echo ${{ env.workdir }}
mkdir ${{ env.workdir }}\channel
mkdir ${{ env.workdir }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.workdir }}\channel\win-64
dir ${{ env.workdir }}\channel\win-64\
- name: Index the channel
shell: cmd /C CALL {0}
run: |
@echo on
conda index ${{ env.workdir }}\channel
- name: List content of the channels
shell: cmd /C CALL {0}
run: |
dir ${{ env.workdir }}\channel
dir ${{ env.workdir }}\channel\win-64
- name: Dump dpctl version info from created channel into ver.json
shell: cmd /C CALL {0}
run: |
@echo on
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.workdir }}/channel --override-channels --info --json > ${{ env.workdir }}\ver.json
dir ${{ env.workdir }}
- name: Output content of produced ver.json
shell: pwsh
run: Get-Content -Path ${{ env.workdir }}\ver.json
- name: Collect dependencies
shell: cmd /C CALL {0}
run: |
IF NOT EXIST ver.json (
copy /Y ${{ env.workdir }}\ver.json .
)
SET "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
- name: Display lockfile content
shell: pwsh
run: Get-Content -Path .\lockfile
- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
CACHE_NUMBER: 3 # Increase to reset cache
with:
path: /home/runner/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Install opencl_rt
shell: cmd /C CALL {0}
run: conda install -n ${{ env.TEST_ENV_NAME }} opencl_rt -c ${{ env.INTEL_CHANNEL }} --override-channels
- name: Install dpctl
shell: cmd /C CALL {0}
run: |
@ECHO ON
IF NOT EXIST ver.json (
copy /Y ${{ env.workdir }}\ver.json .
)
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
SET TEST_DEPENDENCIES=pytest"<8" pytest-cov cython setuptools
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
- name: Report content of test environment
shell: cmd /C CALL {0}
run: |
echo "Value of CONDA environment variable was: " %CONDA%
echo "Value of CONDA_PREFIX environment variable was: " %CONDA_PREFIX%
conda info && conda list -n ${{ env.TEST_ENV_NAME }}
- name: Configure Intel OpenCL 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\bin\cl.cfg"
Get-Content -Tail 5 -Path $cl_cfg
- name: Smoke test, step 1
shell: cmd /C CALL {0}
run: >-
conda activate ${{ env.TEST_ENV_NAME }} && python -c "import sys; print(sys.executable)"
- name: Smoke test, step 2
shell: cmd /C CALL {0}
run: >-
conda activate ${{ env.TEST_ENV_NAME }} && python -m dpctl -f
- name: Create empty temporary directory to run tests from
shell: cmd /C CALL {0}
# create temporary empty folder to runs tests from
# https://github.com/pytest-dev/pytest/issues/11904
run: >-
mkdir "${{ env.workdir }}\test_tmp"
- name: List content of workdir folder
shell: cmd /C CALL {0}
run: dir "${{ env.workdir }}"
- name: Run tests
shell: cmd /C CALL {0}
env:
SYCL_CACHE_PERSISTENT: 1
working-directory: ${{ env.workdir }}\test_tmp
run: >-
conda activate ${{ env.TEST_ENV_NAME }} && python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}
upload_linux:
needs: test_linux
if: |
(github.repository == 'IntelPython/dpctl') &&
(github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Download conda artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Download wheel artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
- name: Install anaconda-client
run: conda install anaconda-client -c conda-forge --override-channels
- name: Add conda to system path
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
- name: Package version
run: echo "PACKAGE_VERSION=$(basename ${{ env.PACKAGE_NAME }}-*.conda | sed 's/^${{ env.PACKAGE_NAME }}-\([^-]*\).*/\1/')" >> "$GITHUB_ENV"
- name: Upload
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
if: ${{ env.ANACONDA_TOKEN != '' }}
run: |
anaconda --token "${{ env.ANACONDA_TOKEN }}" upload --user dppy --label dev "${{ env.PACKAGE_NAME }}"-*.conda
- name: Upload Wheels
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: anaconda --token "${{ env.ANACONDA_TOKEN }}" upload --user dppy --label dev "${{ env.PACKAGE_NAME }}"-*.whl --version "${{ env.PACKAGE_VERSION }}"
upload_windows:
needs: test_windows
if: |
(github.repository == 'IntelPython/dpctl') &&
(github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
runs-on: windows-latest
timeout-minutes: 20
defaults:
run:
shell: cmd /C CALL {0}
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Download artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Download wheel artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
miniforge-version: latest
channels: conda-forge
activate-environment: upload
- name: Install anaconda-client
run: conda install anaconda-client -c conda-forge --override-channels
- name: Package version
shell: bash -el {0}
run: echo "PACKAGE_VERSION=$(basename ${{ env.PACKAGE_NAME }}-*.conda | sed 's/^${{ env.PACKAGE_NAME }}-\([^-]*\).*/\1/')" >> "$GITHUB_ENV"
- name: Upload
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
anaconda --token "${{ env.ANACONDA_TOKEN }}" upload --user dppy --label dev "${{ env.PACKAGE_NAME }}"-*.conda
- name: Upload Wheels
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: anaconda --token "${{ env.ANACONDA_TOKEN }}" upload --user dppy --label dev "${{ env.PACKAGE_NAME }}"-*.whl --version "${{ env.PACKAGE_VERSION }}"
test_examples_linux:
needs: build_linux
runs-on: ${{ matrix.runner }}
strategy:
matrix:
python: ['3.14']
experimental: [false]
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 60
env:
EXAMPLES_ENV_NAME: examples
BUILD_ENV_NAME: build_env
steps:
- name: Construct channels line
run: |
echo "CHANNELS=-c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels" >> "$GITHUB_ENV"
- name: Display channels line
run: |
echo ${{ env.CHANNELS }}
- name: Install conda-index
# Needed to be able to run conda index
run: |
conda update -n base --all
conda install conda-index -c conda-forge --override-channels
- name: Checkout dpctl repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Add conda to system path
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
- name: Create conda channel
run: |
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
conda index "$GITHUB_WORKSPACE/channel" || exit 1
mv "${{ env.PACKAGE_NAME }}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64" || exit 1
conda index "$GITHUB_WORKSPACE/channel" || exit 1
# Test channel
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json"
cat ver.json
- name: Collect dependencies
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export CHANNELS
PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
export PACKAGE_VERSION
# shellcheck disable=SC2086
conda create -n ${{ env.EXAMPLES_ENV_NAME }} ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
cat lockfile
- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
CACHE_NUMBER: 3 # Increase to reset cache
with:
path: ~/.conda/pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Install example requirements
shell: bash -ex -l {0}
env:
DPCPP_CMPLR: "dpcpp_linux-64>=2026.0"
run: |
export CHANNELS="${{ env.CHANNELS }}"
. "$CONDA/etc/profile.d/conda.sh"
DPCTL_DEPENDS="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT3}")"
export DPCTL_DEPENDS
echo "Dpctl dependencies: ${DPCTL_DEPENDS}"
# shellcheck disable=SC2086
conda create -n ${{ env.EXAMPLES_ENV_NAME }} -y pytest python=${{ matrix.python }} "setuptools<72.2.0" $CHANNELS
echo "Environment created"
# shellcheck disable=SC2086
conda install -n ${{ env.EXAMPLES_ENV_NAME }} -y cmake ninja $CHANNELS || exit 1
echo "Cmake and Ninja installed"
# shellcheck disable=SC2086
conda install -n ${{ env.EXAMPLES_ENV_NAME }} -y pybind11 cython scikit-build $CHANNELS || exit 1
echo "scikit-build installed"
# shellcheck disable=SC2086
conda install -n ${{ env.EXAMPLES_ENV_NAME }} -y mkl-dpcpp \
mkl-devel-dpcpp dpcpp_cpp_rt "${DPCTL_DEPENDS}" \
$CHANNELS || exit 1
echo "IPL installed"
# shellcheck disable=SC2086
conda create -y -n ${{ env.BUILD_ENV_NAME }} $CHANNELS gcc_linux-64 gxx_linux-64 \
"${{ env.DPCPP_CMPLR }}" "${DPCTL_DEPENDS}" \
"sysroot_linux-64>=2.28"
echo "Compiler installed"
conda list -n "${{ env.BUILD_ENV_NAME }}"
- name: Install dpctl
shell: bash -l {0}
run: |
source "$CONDA/etc/profile.d/conda.sh"
CHANNELS="-c $GITHUB_WORKSPACE/channel -c dppy/label/dev -c ${{ env.INTEL_CHANNEL }} -c conda-forge --override-channels"
export CHANNELS
PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
export PACKAGE_VERSION
# shellcheck disable=SC2086
conda install -n ${{ env.EXAMPLES_ENV_NAME }} -y $CHANNELS ${{ env.PACKAGE_NAME }}=${PACKAGE_VERSION} || exit 1
- name: Build and run examples of pybind11 extensions
shell: bash -l {0}
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.EXAMPLES_ENV_NAME }}"
conda list
cd examples/pybind11
while IFS= read -r d; do
pushd "$d" > /dev/null
conda activate --stack build_env
CC=icx CXX=icpx python setup.py build_ext --inplace -G Ninja || exit 1
conda deactivate
if [ -e tests ]; then
LD_LIBRARY_PATH="${CONDA_PREFIX}/lib" python -m pytest tests || exit 1
else
LD_LIBRARY_PATH="${CONDA_PREFIX}/lib" python example.py || exit 1
fi
popd > /dev/null
done < <(find . -maxdepth 1 -type d -not -path ".")
- name: Build and run examples of Cython extensions
shell: bash -l {0}
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.EXAMPLES_ENV_NAME }}"
conda list
cd examples/cython
while IFS= read -r d; do
pushd "$d" > /dev/null
conda activate --stack "${{ env.BUILD_ENV_NAME }}"
CC=icx CXX=icpx python setup.py build_ext --inplace -G Ninja || exit 1
conda deactivate
python -m pytest tests || exit 1
popd > /dev/null
done < <(find . -maxdepth 1 -type d -not -path ".")
- name: Build and run examples of C-extensions
shell: bash -l {0}
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.EXAMPLES_ENV_NAME }}"
conda list
cd examples/c
while IFS= read -r d; do
pushd "$d" > /dev/null
conda activate --stack "${{ env.BUILD_ENV_NAME }}"
python setup.py build_ext --inplace || exit 1
conda deactivate
python -m pytest tests || exit 1
popd > /dev/null
done < <(find . -maxdepth 1 -type d -not -path ".")
- name: Run Python examples
shell: bash -l {0}
run: |
cd examples/python
source "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.EXAMPLES_ENV_NAME }}"
while IFS= read -r script; do
echo "Executing ${script}"
python "${script}" --run all || exit 1
done < <(find . \( -not -name "_*" -and -name "*.py" \))
cleanup_packages:
name: Clean up anaconda packages
needs: [upload_linux, upload_windows]
runs-on: 'ubuntu-latest'
timeout-minutes: 30
defaults:
run:
shell: bash -el {0}
steps:
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
run-post: false
channel-priority: "disabled"
channels: conda-forge
python-version: '3.11'
- name: Install anaconda-client
run: conda install anaconda-client -c conda-forge --override-channels
- name: Checkout repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
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