diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index edd3ff06ed2..7bfbf49696e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -71,6 +71,14 @@ jobs: api-endpoint: "api.${{ inputs.environment }}.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: ${{ env.USERNAME }} @@ -85,8 +93,17 @@ jobs: API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io" ACCOUNT_NAME: "firebolt" run: | - pytest -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=INFO tests/integration --alluredir=allure-results + pytest --last-failed -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=INFO tests/integration --alluredir=allure-results + - 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: Get Allure history uses: actions/checkout@v2 if: always() diff --git a/.github/workflows/nightly-workflow.yml b/.github/workflows/nightly-workflow.yml index 4805ce0b98e..22789a76c14 100644 --- a/.github/workflows/nightly-workflow.yml +++ b/.github/workflows/nightly-workflow.yml @@ -67,6 +67,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_STG_USERNAME }} @@ -81,8 +89,17 @@ jobs: ACCOUNT_NAME: "firebolt" API_ENDPOINT: "api.staging.firebolt.io" run: | - pytest --timeout_method "thread" -o log_cli=true -o log_cli_level=INFO --junit-xml=report/junit.xml tests/integration + pytest --last-failed --timeout_method "thread" -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: Foresight Test / Coverage Results uses: runforesight/foresight-test-kit-action@v1 if: success() || failure()