Skip to content

Commit e581830

Browse files
authored
Add a retry for running tests in Conda package action (#1745)
* Add a retry for running tests in Conda package GitHub action * Corrected shell option of retry action * Single line retry command on Win
1 parent 4f10e1d commit e581830

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

.github/workflows/conda-package.yml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ env:
1414
CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
1515
CONDA_BUILD_VERSION: '24.1.2'
1616
CONDA_INDEX_VERSION: '0.4.0'
17+
TEST_ENV_NAME: 'test'
1718
# TODO: to add test_arraymanipulation.py back to the scope once crash on Windows is gone
1819
TEST_SCOPE: >-
1920
test_arraycreation.py
@@ -171,10 +172,10 @@ jobs:
171172
auto-update-conda: true
172173
python-version: ${{ matrix.python }}
173174
miniconda-version: 'latest'
174-
activate-environment: 'test'
175+
activate-environment: ${{ env.TEST_ENV_NAME }}
175176

176177
- name: Install conda-index
177-
run: conda install conda-index=${{ env.CONDA_INDEX_VERSION}}
178+
run: conda install conda-index=${{ env.CONDA_INDEX_VERSION }}
178179

179180
- name: Create conda channel
180181
run: |
@@ -223,10 +224,25 @@ jobs:
223224
python -c "import dpnp; print(dpnp.__version__)"
224225
225226
# TODO: run the whole scope once the issues on CPU are resolved
227+
# - name: Run tests
228+
# run: |
229+
# python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
230+
# working-directory: ${{ env.tests-path }}
231+
232+
# TODO: remove once 2024.2 release is published
226233
- name: Run tests
227-
run: |
228-
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
229-
working-directory: ${{ env.tests-path }}
234+
id: run_tests_linux
235+
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
236+
with:
237+
shell: bash
238+
timeout_minutes: 10
239+
max_attempts: 5
240+
retry_on: any
241+
command: |
242+
. $CONDA/etc/profile.d/conda.sh
243+
conda activate ${{ env.TEST_ENV_NAME }}
244+
cd ${{ env.tests-path }}
245+
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
230246
231247
test_windows:
232248
name: Test ['windows-latest', python='${{ matrix.python }}']
@@ -252,7 +268,6 @@ jobs:
252268
extracted-pkg-path: '${{ github.workspace }}\pkg'
253269
tests-path: '${{ github.workspace }}\pkg\info\test\tests\'
254270
ver-json-path: '${{ github.workspace }}\version.json'
255-
active-env-name: 'test'
256271

257272
steps:
258273
- name: Download artifact
@@ -281,7 +296,7 @@ jobs:
281296
auto-update-conda: true
282297
python-version: ${{ matrix.python }}
283298
miniconda-version: 'latest'
284-
activate-environment: ${{ env.active-env-name }}
299+
activate-environment: ${{ env.TEST_ENV_NAME }}
285300

286301
- name: Store conda paths as envs
287302
run: |
@@ -362,10 +377,24 @@ jobs:
362377
python -c "import dpnp; print(dpnp.__version__)"
363378
364379
# TODO: run the whole scope once the issues on CPU are resolved
380+
# - name: Run tests
381+
# run: |
382+
# python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
383+
# working-directory: ${{ env.tests-path }}
384+
385+
# TODO: remove once 2024.2 release is published
365386
- name: Run tests
366-
run: |
367-
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
368-
working-directory: ${{ env.tests-path }}
387+
id: run_tests_win
388+
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
389+
with:
390+
shell: cmd
391+
timeout_minutes: 15
392+
max_attempts: 5
393+
retry_on: any
394+
command: >-
395+
conda activate ${{ env.TEST_ENV_NAME }}
396+
& cd ${{ env.tests-path }}
397+
& python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
369398
370399
upload:
371400
name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}']

0 commit comments

Comments
 (0)