From 4d83d84bf0f397c752c6d6a600aa02d63fcddf88 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 25 Nov 2024 14:36:38 +0100 Subject: [PATCH 1/3] Add a retry for running tests in nightly action --- .github/workflows/conda-package.yml | 8 +++--- .github/workflows/cron-run-tests.yaml | 35 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 37255b25ebe7..82cd7509b830 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -188,8 +188,10 @@ jobs: retry_on: any command: | . $CONDA/etc/profile.d/conda.sh - conda activate ${{ env.TEST_ENV_NAME }} - pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests + . $CONDA/etc/profile.d/mamba.sh + mamba activate ${{ env.TEST_ENV_NAME }} + + python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests test_windows: name: Test ['windows-2019', python='${{ matrix.python }}'] @@ -323,7 +325,7 @@ jobs: retry_on: any command: >- mamba activate ${{ env.TEST_ENV_NAME }} - & pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests + & python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests upload: name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}'] diff --git a/.github/workflows/cron-run-tests.yaml b/.github/workflows/cron-run-tests.yaml index 2a8da89d2bd0..d1fe82feddf8 100644 --- a/.github/workflows/cron-run-tests.yaml +++ b/.github/workflows/cron-run-tests.yaml @@ -15,6 +15,8 @@ env: PACKAGE_NAME: dpnp CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels' TEST_ENV_NAME: test + RERUN_TESTS_ON_FAILURE: 'true' + RUN_TESTS_MAX_ATTEMPTS: 2 jobs: test: @@ -82,7 +84,40 @@ jobs: python -c "import dpnp; print(dpnp.__version__)" - name: Run tests + if: env.RERUN_TESTS_ON_FAILURE != 'true' run: | python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests env: SYCL_CACHE_PERSISTENT: 1 + + - name: ReRun tests on Linux + if: env.RERUN_TESTS_ON_FAILURE == 'true' && matrix.runner != 'windows-2019' + id: run_tests_linux + uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 + with: + timeout_minutes: 10 + max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }} + retry_on: any + command: | + . $CONDA/etc/profile.d/conda.sh + . $CONDA/etc/profile.d/mamba.sh + mamba activate ${{ env.TEST_ENV_NAME }} + + echo "SYCL_CACHE_PERSISTENT=$SYCL_CACHE_PERSISTENT" + + python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests + env: + SYCL_CACHE_PERSISTENT: 1 + + - name: ReRun tests on Windows + if: env.RERUN_TESTS_ON_FAILURE == 'true' && matrix.runner == 'windows-2019' + id: run_tests_win + uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 + with: + timeout_minutes: 15 + max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }} + retry_on: any + command: | + python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests + env: + SYCL_CACHE_PERSISTENT: 1 From 55bc7f283fcfc93e39001d68b2c6ded3d6f99c9d Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 25 Nov 2024 15:49:42 +0100 Subject: [PATCH 2/3] nick-fields/retry action now passes shell arguments --- .github/workflows/conda-package.yml | 7 ++----- .github/workflows/cron-run-tests.yaml | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 82cd7509b830..6e4b8979a9df 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -182,7 +182,6 @@ jobs: id: run_tests_linux uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 with: - shell: bash timeout_minutes: 10 max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }} retry_on: any @@ -319,13 +318,11 @@ jobs: id: run_tests_win uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 with: - shell: cmd timeout_minutes: 15 max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }} retry_on: any - command: >- - mamba activate ${{ env.TEST_ENV_NAME }} - & python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests + command: | + python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests upload: name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}'] diff --git a/.github/workflows/cron-run-tests.yaml b/.github/workflows/cron-run-tests.yaml index d1fe82feddf8..219c75a7b572 100644 --- a/.github/workflows/cron-run-tests.yaml +++ b/.github/workflows/cron-run-tests.yaml @@ -103,8 +103,6 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.TEST_ENV_NAME }} - echo "SYCL_CACHE_PERSISTENT=$SYCL_CACHE_PERSISTENT" - python -m pytest -ra --pyargs ${{ env.PACKAGE_NAME }}.tests env: SYCL_CACHE_PERSISTENT: 1 From d3449e25426dd602553d85a5a4641b9ad3ef93ef Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 25 Nov 2024 16:20:30 +0100 Subject: [PATCH 3/3] Add rerun to actions testing oneMKL interfaces --- .github/workflows/check-mkl-interfaces.yaml | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/check-mkl-interfaces.yaml b/.github/workflows/check-mkl-interfaces.yaml index 826d6cdd2bdb..791f4c59e1b8 100644 --- a/.github/workflows/check-mkl-interfaces.yaml +++ b/.github/workflows/check-mkl-interfaces.yaml @@ -11,6 +11,8 @@ permissions: read-all env: CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels' TEST_ENV_NAME: 'test_onemkl_interfaces' + RERUN_TESTS_ON_FAILURE: 'true' + RUN_TESTS_MAX_ATTEMPTS: 2 BUILD_DEP_PKGS: >- mkl-devel-dpcpp tbb-devel @@ -95,11 +97,29 @@ jobs: mamba install pytest ${{ env.CHANNELS }} - name: Run tests + if: env.RERUN_TESTS_ON_FAILURE != 'true' run: | python -m pytest -ra --pyargs dpnp.tests env: SYCL_CACHE_PERSISTENT: 1 + - name: ReRun tests on Linux + if: env.RERUN_TESTS_ON_FAILURE == 'true' + id: run_tests + uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 + with: + timeout_minutes: 10 + max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }} + retry_on: any + command: | + . $CONDA/etc/profile.d/conda.sh + . $CONDA/etc/profile.d/mamba.sh + mamba activate ${{ env.TEST_ENV_NAME }} + + python -m pytest -ra --pyargs dpnp.tests + env: + SYCL_CACHE_PERSISTENT: 1 + test_by_branch: name: Run on ['${{ matrix.os }}', python='${{ matrix.python }}'] with oneMKL develop branch @@ -185,7 +205,25 @@ jobs: mamba install pytest ${{ env.CHANNELS }} - name: Run tests + if: env.RERUN_TESTS_ON_FAILURE != 'true' run: | python -m pytest -ra --pyargs dpnp.tests env: SYCL_CACHE_PERSISTENT: 1 + + - name: ReRun tests on Linux + if: env.RERUN_TESTS_ON_FAILURE == 'true' + id: run_tests + uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 + with: + timeout_minutes: 10 + max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }} + retry_on: any + command: | + . $CONDA/etc/profile.d/conda.sh + . $CONDA/etc/profile.d/mamba.sh + mamba activate ${{ env.TEST_ENV_NAME }} + + python -m pytest -ra --pyargs dpnp.tests + env: + SYCL_CACHE_PERSISTENT: 1