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.
This commit is contained in:
Shawn Callegari
2023-08-07 20:15:30 -07:00
committed by GitHub
parent a3928e8edd
commit b61127ac67
+16 -4
View File
@@ -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!')