From b61127ac675047c62e36e7fac97c05f8e08d8209 Mon Sep 17 00:00:00 2001 From: Shawn Callegari <36091529+shawncal@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:15:30 -0700 Subject: [PATCH] Update python-integration-tests.yml (#2318) Adding a final job to the python integration tests. This job's only role is to if and only if one of the other jobs failed. If they succeeded or were skipped, this job is effectively a no-op, but it will complete as success. This will be the job marked as "required" in the GitHub settings, so that both PRs and Merge Queue can run and succeed to meet the requirement. even when there are no tests to run. --- .../workflows/python-integration-tests.yml | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-integration-tests.yml b/.github/workflows/python-integration-tests.yml index a305ebd885..a9d2b1ba4a 100644 --- a/.github/workflows/python-integration-tests.yml +++ b/.github/workflows/python-integration-tests.yml @@ -8,12 +8,8 @@ on: workflow_dispatch: pull_request: branches: ["main"] - paths: - - "python/**" merge_group: branches: ["main"] - paths: - - "python/**" schedule: - cron: "0 0 * * *" # Run at midnight UTC daily @@ -97,6 +93,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies with hnswlib native disabled if: matrix.os == 'macos-latest' && matrix.python-version == '3.11' run: | @@ -104,12 +101,14 @@ jobs: python -m pip install --upgrade pip setuptools wheel python -m pip install poetry pytest cd python && poetry install + - name: Install dependencies with hnswlib native enabled if: matrix.os != 'macos-latest' || matrix.python-version != '3.11' run: | python -m pip install --upgrade pip setuptools wheel python -m pip install poetry pytest cd python && poetry install + - name: Run Integration Tests id: run_tests shell: bash @@ -139,6 +138,7 @@ jobs: echo "Test Output<<$EOF" >> "$GITHUB_OUTPUT" echo "$(poetry run pytest ./tests/integration)" >> "$GITHUB_OUTPUT" echo "$EOF" >> "$GITHUB_OUTPUT" + - name: Microsoft Teams Notification uses: skitionek/notify-microsoft-teams@master if: always() @@ -149,3 +149,15 @@ jobs: job: ${{ toJson(job) }} steps: ${{ toJson(steps) }} overwrite: "{title: ` ${{ github.event_name }} ${{ steps.run_tests.outcome }}: ${{ env.date }} - ${{ matrix.python-version }} on ${{ matrix.os }}`, text: ` ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n${{ toJson(steps.run_tests.outputs) }}`}" + + # This final job is required to satisfy the merge queue. It must only run (or succeed) if no tests failed + python-integration-tests-check: + runs-on: ubuntu-latest + if: always() + needs: [python-merge-gate, python-integration-tests] + steps: + - name: Fail workflow if tests failed + if: contains(join(needs.*.result, ','), 'failed') + uses: actions/github-script@v3 + with: + script: core.setFailed('Integration Tests Failed!')