From b3f71388654d2dbca6d688596ce049254051c206 Mon Sep 17 00:00:00 2001 From: RotemFB Date: Thu, 20 Jul 2023 15:09:06 +0300 Subject: [PATCH] Added caching of failed tests --- .github/workflows/nightly.yml | 19 ++++++++++++++++++- .../workflows/python-integration-tests.yml | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 912a136..adfbd42 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -52,6 +52,14 @@ jobs: region: "us-east-1" db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }} + - name: Restore cached failed tests + id: cache-tests-restore + uses: actions/cache/restore@v3 + with: + path: | + .pytest_cache/v/cache/lastfailed + key: ${{ runner.os }}-pytest-restore-failed-${{ github.ref }}-${{ github.sha }} + - name: Run integration tests env: USER_NAME: ${{ secrets.FIREBOLT_USERNAME }} @@ -66,7 +74,16 @@ jobs: ACCOUNT_NAME: "firebolt" FIREBOLT_BASE_URL: "api.dev.firebolt.io" run: | - pytest -o log_cli=true -o log_cli_level=INFO --junit-xml=report/junit.xml tests/integration + pytest --last-failed -o log_cli=true -o log_cli_level=INFO --junit-xml=report/junit.xml tests/integration + + - name: Save failed tests + id: cache-tests-save + uses: actions/cache/save@v3 + if: failure() + with: + path: | + .pytest_cache/v/cache/lastfailed + key: ${{ steps.cache-tests-restore.outputs.cache-primary-key }} - name: Slack Notify of failure if: failure() diff --git a/.github/workflows/python-integration-tests.yml b/.github/workflows/python-integration-tests.yml index abd2be8..44bf374 100644 --- a/.github/workflows/python-integration-tests.yml +++ b/.github/workflows/python-integration-tests.yml @@ -29,6 +29,14 @@ jobs: api-endpoint: "api.dev.firebolt.io" region: "us-east-1" + - name: Restore cached failed tests + id: cache-tests-restore + uses: actions/cache/restore@v3 + with: + path: | + .pytest_cache/v/cache/lastfailed + key: ${{ runner.os }}-pytest-restore-failed-${{ github.ref }}-${{ github.sha }} + - name: Run integration tests env: USER_NAME: ${{ secrets.FIREBOLT_USERNAME }} @@ -42,4 +50,13 @@ jobs: STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }} FIREBOLT_BASE_URL: "api.dev.firebolt.io" run: | - pytest -o log_cli=true -o log_cli_level=INFO tests/integration + pytest --last-failed -o log_cli=true -o log_cli_level=INFO tests/integration + + - name: Save failed tests + id: cache-tests-save + uses: actions/cache/save@v3 + if: failure() + with: + path: | + .pytest_cache/v/cache/lastfailed + key: ${{ steps.cache-tests-restore.outputs.cache-primary-key }}