99permissions : read-all
1010
1111env :
12- CHANNELS : ' -c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels'
13- TEST_ENV_NAME : ' test_onemkl_interfaces'
14- RERUN_TESTS_ON_FAILURE : ' true'
15- RUN_TESTS_MAX_ATTEMPTS : 2
16- BUILD_DEP_PKGS : >-
17- mkl-devel-dpcpp
18- tbb-devel
19- dpctl
20- onedpl-devel
21- setuptools
22- python
23- numpy
24- cython
25- cmake
26- ninja
27- scikit-build
12+ environment-file : ' environments/environment.yml'
13+ environment-file-name : ' environment.yml'
14+ environment-file-loc : ' ${{ github.workspace }}/environments'
15+ build-with-oneapi-env : ' environments/build_with_oneapi.yml'
16+ oneapi-pkgs-env : ' environments/oneapi_pkgs.yml'
17+ test-env-name : ' test_onemkl_interfaces'
18+ rerun-tests-on-failure : ' true'
19+ rerun-tests-max-attempts : 2
20+ rerun-tests-timeout : 20
2821
2922jobs :
23+ build_env_file :
24+ name : Build conda env file
25+
26+ permissions :
27+ # Needed to cancel any previous runs that are not completed for a given workflow
28+ actions : write
29+
30+ runs-on : ' ubuntu-latest'
31+
32+ steps :
33+ - name : Cancel Previous Runs
34+ uses : styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
35+ with :
36+ access_token : ${{ github.token }}
37+
38+ - name : Checkout DPNP repo
39+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+ with :
41+ fetch-depth : 0
42+
43+ - name : Install conda-merge tool
44+ uses : BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1
45+ with :
46+ packages : conda-merge
47+
48+ - name : Merge conda env files
49+ run : |
50+ conda-merge ${{ env.build-with-oneapi-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }}
51+
52+ - name : Upload artifact
53+ uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
54+ with :
55+ name : ${{ env.environment-file-name }}
56+ path : ${{ env.environment-file }}
57+
3058 test_by_tag :
3159 name : Run tests with oneMKL tag
3260
61+ needs : build_env_file
62+
3363 strategy :
64+ fail-fast : false
3465 matrix :
3566 # python 3.13 is blocked since BLAS requires "mkl<2025.0" (see https://github.com/conda-forge/blas-feedstock/pull/128
3667 # which depends on resolving MKL issue https://github.com/conda-forge/intel_repack-feedstock/issues/83)
3768 python : ['3.12']
3869 os : [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL
3970
40- permissions :
41- # Needed to cancel any previous runs that are not completed for a given workflow
42- actions : write
43-
4471 runs-on : ${{ matrix.os }}
4572
4673 defaults :
4774 run :
4875 shell : ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
4976
50- continue-on-error : false
51-
5277 steps :
53- - name : Cancel Previous Runs
54- uses : styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
55- with :
56- access_token : ${{ github.token }}
57-
5878 - name : Checkout DPNP repo
5979 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6080 with :
6181 fetch-depth : 0
6282
83+ - name : Download artifact
84+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
85+ with :
86+ name : ${{ env.environment-file-name }}
87+ path : ${{ env.environment-file-loc }}
88+
6389 - name : Setup miniconda
90+ id : setup_miniconda
91+ continue-on-error : true
6492 uses : conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
6593 with :
6694 miniforge-version : latest
6795 use-mamba : ' true'
68- channels : conda-forge
6996 conda-remove-defaults : ' true'
70- python-version : ${{ matrix.python }}
71- activate-environment : ${{ env.TEST_ENV_NAME }}
72-
73- # Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
74- - name : Disable speed limit check in mamba
75- run : echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
97+ environment-file : ${{ env.environment-file }}
98+ activate-environment : ${{ env.test-env-name }}
7699
77- - name : Install dpnp build dependencies
78- run : |
79- mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
80- env :
81- DPCPP_PKG : ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}
100+ - name : ReSetup miniconda
101+ if : steps.setup_miniconda.outcome == 'failure'
102+ uses : conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
103+ with :
104+ miniforge-version : latest
105+ use-mamba : ' true'
106+ conda-remove-defaults : ' true'
107+ environment-file : ${{ env.environment-file }}
108+ activate-environment : ${{ env.test-env-name }}
82109
83110 - name : Conda info
84111 run : |
@@ -94,29 +121,25 @@ jobs:
94121 python -m dpctl -f
95122 python -c "import dpnp; print(dpnp.__version__)"
96123
97- - name : Install pytest
98- run : |
99- mamba install pytest ${{ env.CHANNELS }}
100-
101124 - name : Run tests
102- if : env.RERUN_TESTS_ON_FAILURE != 'true'
125+ if : env.rerun-tests-on-failure != 'true'
103126 run : |
104127 python -m pytest -ra --pyargs dpnp.tests
105128 env :
106129 SYCL_CACHE_PERSISTENT : 1
107130
108131 - name : ReRun tests on Linux
109- if : env.RERUN_TESTS_ON_FAILURE == 'true'
132+ if : env.rerun-tests-on-failure == 'true'
110133 id : run_tests
111134 uses : nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
112135 with :
113- timeout_minutes : 12
114- max_attempts : ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
136+ timeout_minutes : ${{ env.rerun-tests-timeout }}
137+ max_attempts : ${{ env.rerun-tests-max-attempts }}
115138 retry_on : any
116139 command : |
117140 . $CONDA/etc/profile.d/conda.sh
118141 . $CONDA/etc/profile.d/mamba.sh
119- mamba activate ${{ env.TEST_ENV_NAME }}
142+ mamba activate ${{ env.test-env-name }}
120143
121144 python -m pytest -ra --pyargs dpnp.tests
122145 env :
@@ -125,39 +148,37 @@ jobs:
125148 test_by_branch :
126149 name : Run tests with oneMKL develop branch
127150
151+ needs : build_env_file
152+
128153 strategy :
154+ fail-fast : false
129155 matrix :
130156 # python 3.13 is blocked since BLAS requires "mkl<2025.0" (see https://github.com/conda-forge/blas-feedstock/pull/128
131157 # which depends on resolving MKL issue https://github.com/conda-forge/intel_repack-feedstock/issues/83)
132158 python : ['3.12']
133159 os : [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL
134160
135- permissions :
136- # Needed to cancel any previous runs that are not completed for a given workflow
137- actions : write
138-
139161 runs-on : ${{ matrix.os }}
140162
141163 defaults :
142164 run :
143165 shell : ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
144166
145- continue-on-error : true
146-
147167 env :
148168 onemkl-source-dir : ' ${{ github.workspace }}/onemkl/'
149169
150170 steps :
151- - name : Cancel Previous Runs
152- uses : styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
153- with :
154- access_token : ${{ github.token }}
155-
156171 - name : Checkout DPNP repo
157172 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
158173 with :
159174 fetch-depth : 0
160175
176+ - name : Download artifact
177+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
178+ with :
179+ name : ${{ env.environment-file-name }}
180+ path : ${{ env.environment-file-loc }}
181+
161182 - name : Checkout oneMKL repo
162183 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
163184 with :
@@ -171,24 +192,25 @@ jobs:
171192 ls -la ${{ env.onemkl-source-dir }}
172193
173194 - name : Setup miniconda
195+ id : setup_miniconda
196+ continue-on-error : true
174197 uses : conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
175198 with :
176199 miniforge-version : latest
177200 use-mamba : ' true'
178- channels : conda-forge
179201 conda-remove-defaults : ' true'
180- python-version : ${{ matrix.python }}
181- activate-environment : ${{ env.TEST_ENV_NAME }}
202+ environment-file : ${{ env.environment-file }}
203+ activate-environment : ${{ env.test-env-name }}
182204
183- # Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
184- - name : Disable speed limit check in mamba
185- run : echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
186-
187- - name : Install dpnp build dependencies
188- run : |
189- mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
190- env :
191- DPCPP_PKG : ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}
205+ - name : ReSetup miniconda
206+ if : steps.setup_miniconda.outcome == 'failure'
207+ uses : conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
208+ with :
209+ miniforge-version : latest
210+ use-mamba : ' true '
211+ conda-remove-defaults : ' true '
212+ environment-file : ${{ env.environment-file }}
213+ activate-environment : ${{ env.test-env-name }}
192214
193215 - name : Conda info
194216 run : |
@@ -204,29 +226,25 @@ jobs:
204226 python -m dpctl -f
205227 python -c "import dpnp; print(dpnp.__version__)"
206228
207- - name : Install pytest
208- run : |
209- mamba install pytest ${{ env.CHANNELS }}
210-
211229 - name : Run tests
212- if : env.RERUN_TESTS_ON_FAILURE ! = 'true'
230+ if : env.rerun-tests-on-failure = = 'true'
213231 run : |
214232 python -m pytest -ra --pyargs dpnp.tests
215233 env :
216234 SYCL_CACHE_PERSISTENT : 1
217235
218236 - name : ReRun tests on Linux
219- if : env.RERUN_TESTS_ON_FAILURE == 'true'
237+ if : env.rerun-tests-on-failure == 'true'
220238 id : run_tests
221239 uses : nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
222240 with :
223- timeout_minutes : 15
224- max_attempts : ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
241+ timeout_minutes : ${{ env.rerun-tests-timeout }}
242+ max_attempts : ${{ env.rerun-tests-max-attempts }}
225243 retry_on : any
226244 command : |
227245 . $CONDA/etc/profile.d/conda.sh
228246 . $CONDA/etc/profile.d/mamba.sh
229- mamba activate ${{ env.TEST_ENV_NAME }}
247+ mamba activate ${{ env.test-env-name }}
230248
231249 python -m pytest -ra --pyargs dpnp.tests
232250 env :
0 commit comments