Skip to content

Commit 77578bf

Browse files
committed
Add a retry for running tests in nightly action
1 parent cd23361 commit 77578bf

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

.github/workflows/conda-package.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,10 @@ jobs:
188188
retry_on: any
189189
command: |
190190
. $CONDA/etc/profile.d/conda.sh
191-
conda activate ${{ env.TEST_ENV_NAME }}
192-
pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
191+
. $CONDA/etc/profile.d/mamba.sh
192+
mamba activate ${{ env.TEST_ENV_NAME }}
193+
194+
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
193195
194196
test_windows:
195197
name: Test ['windows-2019', python='${{ matrix.python }}']
@@ -323,7 +325,7 @@ jobs:
323325
retry_on: any
324326
command: >-
325327
mamba activate ${{ env.TEST_ENV_NAME }}
326-
& pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
328+
& python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
327329
328330
upload:
329331
name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}']

.github/workflows/cron-run-tests.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ env:
1515
PACKAGE_NAME: dpnp
1616
CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels'
1717
TEST_ENV_NAME: test
18+
RERUN_TESTS_ON_FAILURE: 'true'
19+
RUN_TESTS_MAX_ATTEMPTS: 2
1820

1921
jobs:
2022
test:
@@ -82,7 +84,39 @@ jobs:
8284
python -c "import dpnp; print(dpnp.__version__)"
8385
8486
- name: Run tests
87+
if: env.RERUN_TESTS_ON_FAILURE != 'true'
8588
run: |
8689
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
8790
env:
8891
SYCL_CACHE_PERSISTENT: 1
92+
93+
- name: ReRun tests on Linux
94+
if: env.RERUN_TESTS_ON_FAILURE == 'true' && matrix.runner != 'windows-2019'
95+
id: run_tests_linux
96+
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
97+
with:
98+
shell: bash
99+
timeout_minutes: 10
100+
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
101+
retry_on: any
102+
command: |
103+
. $CONDA/etc/profile.d/conda.sh
104+
. $CONDA/etc/profile.d/mamba.sh
105+
mamba activate ${{ env.TEST_ENV_NAME }}
106+
107+
export SYCL_CACHE_PERSISTENT=1
108+
python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests
109+
110+
- name: ReRun tests on Windows
111+
if: env.RERUN_TESTS_ON_FAILURE == 'true' && matrix.runner == 'windows-2019'
112+
id: run_tests_win
113+
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
114+
with:
115+
shell: cmd
116+
timeout_minutes: 15
117+
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
118+
retry_on: any
119+
command: >-
120+
mamba activate ${{ env.TEST_ENV_NAME }}
121+
& set SYCL_CACHE_PERSISTENT=1
122+
& python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests

0 commit comments

Comments
 (0)