Skip to content

Commit b862d22

Browse files
committed
Add environment file to oneMath i/f workflow
1 parent a24bd3c commit b862d22

File tree

1 file changed

+92
-74
lines changed

1 file changed

+92
-74
lines changed

.github/workflows/check-mkl-interfaces.yaml

Lines changed: 92 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,74 +9,101 @@ on:
99
permissions: read-all
1010

1111
env:
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">=2.0"
24-
cython
25-
cmake
26-
ninja
27-
scikit-build
12+
environment-file-name: 'environment.yml'
13+
environment-file: 'environments/environment.yml'
14+
build-with-oneapi-env: 'environments/build_with_oneapi.yml'
15+
coverage-env: 'environments/coverage.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

2922
jobs:
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']
3667
os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL
3768

38-
permissions:
39-
# Needed to cancel any previous runs that are not completed for a given workflow
40-
actions: write
41-
4269
runs-on: ${{ matrix.os }}
4370

4471
defaults:
4572
run:
4673
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
4774

48-
continue-on-error: false
49-
5075
steps:
51-
- name: Cancel Previous Runs
52-
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
76+
- name: Download artifact
77+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
5378
with:
54-
access_token: ${{ github.token }}
79+
name: ${{ env.environment-file-name }}
80+
path: ${{ env.environment-file }}
5581

5682
- name: Checkout DPNP repo
5783
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5884
with:
5985
fetch-depth: 0
6086

6187
- name: Setup miniconda
88+
id: setup_miniconda
89+
continue-on-error: true
6290
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
6391
with:
6492
miniforge-version: latest
6593
use-mamba: 'true'
66-
channels: conda-forge
6794
conda-remove-defaults: 'true'
68-
python-version: ${{ matrix.python }}
69-
activate-environment: ${{ env.TEST_ENV_NAME }}
70-
71-
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
72-
- name: Disable speed limit check in mamba
73-
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
95+
environment-file: '${{ env.environment-file }}'
96+
activate-environment: ${{ env.test-env-name }}
7497

75-
- name: Install dpnp build dependencies
76-
run: |
77-
mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
78-
env:
79-
DPCPP_PKG: ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}
98+
- name: ReSetup miniconda
99+
if: steps.setup_miniconda.outcome == 'failure'
100+
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
101+
with:
102+
miniforge-version: latest
103+
use-mamba: 'true'
104+
conda-remove-defaults: 'true'
105+
environment-file: '${{ env.environment-file }}'
106+
activate-environment: ${{ env.test-env-name }}
80107

81108
- name: Conda info
82109
run: |
@@ -92,24 +119,20 @@ jobs:
92119
python -m dpctl -f
93120
python -c "import dpnp; print(dpnp.__version__)"
94121
95-
- name: Install pytest
96-
run: |
97-
mamba install pytest ${{ env.CHANNELS }}
98-
99122
- name: Run tests
100-
if: env.RERUN_TESTS_ON_FAILURE != 'true'
123+
if: env.rerun-tests-on-failure != 'true'
101124
run: |
102125
python -m pytest -ra --pyargs dpnp.tests
103126
env:
104127
SYCL_CACHE_PERSISTENT: 1
105128

106129
- name: ReRun tests on Linux
107-
if: env.RERUN_TESTS_ON_FAILURE == 'true'
130+
if: env.rerun-tests-on-failure == 'true'
108131
id: run_tests
109132
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
110133
with:
111-
timeout_minutes: 12
112-
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
134+
timeout_minutes: ${{ env.rerun-tests-timeout }}
135+
max_attempts: ${{ env.rerun-tests-max-attempts }}
113136
retry_on: any
114137
command: |
115138
. $CONDA/etc/profile.d/conda.sh
@@ -123,31 +146,29 @@ jobs:
123146
test_by_branch:
124147
name: Run tests with oneMKL develop branch
125148

149+
needs: build_env_file
150+
126151
strategy:
152+
fail-fast: false
127153
matrix:
128154
python: ['3.13']
129155
os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL
130156

131-
permissions:
132-
# Needed to cancel any previous runs that are not completed for a given workflow
133-
actions: write
134-
135157
runs-on: ${{ matrix.os }}
136158

137159
defaults:
138160
run:
139161
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
140162

141-
continue-on-error: true
142-
143163
env:
144164
onemkl-source-dir: '${{ github.workspace }}/onemkl/'
145165

146166
steps:
147-
- name: Cancel Previous Runs
148-
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
167+
- name: Download artifact
168+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
149169
with:
150-
access_token: ${{ github.token }}
170+
name: ${{ env.environment-file-name }}
171+
path: ${{ env.environment-file }}
151172

152173
- name: Checkout DPNP repo
153174
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -167,24 +188,25 @@ jobs:
167188
ls -la ${{ env.onemkl-source-dir }}
168189
169190
- name: Setup miniconda
191+
id: setup_miniconda
192+
continue-on-error: true
170193
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
171194
with:
172195
miniforge-version: latest
173196
use-mamba: 'true'
174-
channels: conda-forge
175197
conda-remove-defaults: 'true'
176-
python-version: ${{ matrix.python }}
177-
activate-environment: ${{ env.TEST_ENV_NAME }}
178-
179-
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
180-
- name: Disable speed limit check in mamba
181-
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
198+
environment-file: '${{ env.environment-file }}'
199+
activate-environment: ${{ env.test-env-name }}
182200

183-
- name: Install dpnp build dependencies
184-
run: |
185-
mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
186-
env:
187-
DPCPP_PKG: ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}
201+
- name: ReSetup miniconda
202+
if: steps.setup_miniconda.outcome == 'failure'
203+
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
204+
with:
205+
miniforge-version: latest
206+
use-mamba: 'true'
207+
conda-remove-defaults: 'true'
208+
environment-file: '${{ env.environment-file }}'
209+
activate-environment: ${{ env.test-env-name }}
188210

189211
- name: Conda info
190212
run: |
@@ -200,24 +222,20 @@ jobs:
200222
python -m dpctl -f
201223
python -c "import dpnp; print(dpnp.__version__)"
202224
203-
- name: Install pytest
204-
run: |
205-
mamba install pytest ${{ env.CHANNELS }}
206-
207225
- name: Run tests
208-
if: env.RERUN_TESTS_ON_FAILURE != 'true'
226+
if: env.rerun-tests-on-failure == 'true'
209227
run: |
210228
python -m pytest -ra --pyargs dpnp.tests
211229
env:
212230
SYCL_CACHE_PERSISTENT: 1
213231

214232
- name: ReRun tests on Linux
215-
if: env.RERUN_TESTS_ON_FAILURE == 'true'
233+
if: env.rerun-tests-on-failure == 'true'
216234
id: run_tests
217235
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
218236
with:
219-
timeout_minutes: 15
220-
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
237+
timeout_minutes: ${{ env.rerun-tests-timeout }}
238+
max_attempts: ${{ env.rerun-tests-max-attempts }}
221239
retry_on: any
222240
command: |
223241
. $CONDA/etc/profile.d/conda.sh

0 commit comments

Comments
 (0)