Skip to content

Commit 5da0a7f

Browse files
ci: post direct links to html connector test reports (#252) (#263)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Aaron <AJ> Steers <[email protected]>
1 parent 97419d0 commit 5da0a7f

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

.github/workflows/connector-tests.yml

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ concurrency:
2525
jobs:
2626
cdk_changes:
2727
name: Get Changes
28-
runs-on: ubuntu-24.04
28+
runs-on: ubuntu-22.04
2929
permissions:
3030
statuses: write
3131
pull-requests: read
@@ -62,7 +62,7 @@ jobs:
6262
# Forked PRs are handled by the community_ci.yml workflow
6363
# If the condition is not met the job will be skipped (it will not fail)
6464
# runs-on: connector-test-large
65-
runs-on: ubuntu-24.04
65+
runs-on: ubuntu-22.04
6666
timeout-minutes: 360 # 6 hours
6767
strategy:
6868
fail-fast: false
@@ -96,6 +96,8 @@ jobs:
9696
name: "Check: '${{matrix.connector}}' (skip=${{needs.cdk_changes.outputs['src'] == 'false' || needs.cdk_changes.outputs[matrix.cdk_extra] == 'false'}})"
9797
permissions:
9898
checks: write
99+
contents: write # Required for creating commit statuses
100+
pull-requests: read
99101
steps:
100102
- name: Abort if extra not changed (${{matrix.cdk_extra}})
101103
id: no_changes
@@ -127,6 +129,22 @@ jobs:
127129
uses: actions/setup-python@v5
128130
with:
129131
python-version: "3.10"
132+
# Create initial pending status for test report
133+
- name: Create Pending Test Report Status
134+
if: steps.no_changes.outputs.status != 'cancelled'
135+
env:
136+
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
137+
run: |
138+
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
139+
gh api \
140+
--method POST \
141+
-H "Accept: application/vnd.github+json" \
142+
-H "X-GitHub-Api-Version: 2022-11-28" \
143+
repos/${{ github.repository }}/statuses/$HEAD_SHA \
144+
-f state="pending" \
145+
-f description="Running connector tests..." \
146+
-f context="${{ matrix.connector }} Test Report"
147+
130148
- name: Test Connector
131149
if: steps.no_changes.outputs.status != 'cancelled'
132150
timeout-minutes: 90
@@ -173,6 +191,39 @@ jobs:
173191
echo "success=${success}" >> $GITHUB_OUTPUT
174192
echo "html_report_url=${html_report_url}" >> $GITHUB_OUTPUT
175193
194+
# Update the test report status with results
195+
- name: Update Test Report Status
196+
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome == 'success'
197+
env:
198+
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
199+
run: |
200+
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
201+
gh api \
202+
--method POST \
203+
-H "Accept: application/vnd.github+json" \
204+
-H "X-GitHub-Api-Version: 2022-11-28" \
205+
repos/${{ github.repository }}/statuses/$HEAD_SHA \
206+
-f state="${{ steps.evaluate_output.outputs.success == 'true' && 'success' || 'failure' }}" \
207+
-f target_url="${{ steps.evaluate_output.outputs.html_report_url }}" \
208+
-f description="Click Details to view the test report" \
209+
-f context="${{ matrix.connector }} Test Report"
210+
211+
# Create failure status if report generation failed
212+
- name: Create Report Generation Failed Status
213+
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome != 'success'
214+
env:
215+
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
216+
run: |
217+
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
218+
gh api \
219+
--method POST \
220+
-H "Accept: application/vnd.github+json" \
221+
-H "X-GitHub-Api-Version: 2022-11-28" \
222+
repos/${{ github.repository }}/statuses/$HEAD_SHA \
223+
-f state="failure" \
224+
-f description="Failed to run connector tests." \
225+
-f context="${{ matrix.connector }} Test Report"
226+
176227
# Upload the job output to the artifacts
177228
- name: Upload Job Output
178229
id: upload_job_output

0 commit comments

Comments
 (0)