Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: display HTML test report URLs in check run summaries (#252) #262

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
60595b7
feat: link HTML test reports in GitHub check results (#252)
devin-ai-integration[bot] Jan 23, 2025
108eb51
dummy commit to force execution
aaronsteers Jan 23, 2025
4439078
fix: improve error handling and add GH_TOKEN for check run updates
devin-ai-integration[bot] Jan 23, 2025
2bc6be7
Merge branch 'devin/1675093412-check-run-link' of https://github.com/…
devin-ai-integration[bot] Jan 23, 2025
e09f855
fix: add contents read permission for check runs
devin-ai-integration[bot] Jan 23, 2025
3651cd3
fix: add delay and improve error handling for check run ID detection
devin-ai-integration[bot] Jan 23, 2025
2cb0444
fix: include skip parameter in check run name search
devin-ai-integration[bot] Jan 23, 2025
2b35eb4
fix: add verbose logging for check run ID detection
devin-ai-integration[bot] Jan 23, 2025
c5c6b91
fix: use GitHub Actions context for check run ID
devin-ai-integration[bot] Jan 23, 2025
66feb34
fix: use GitHub API to get check run ID
devin-ai-integration[bot] Jan 23, 2025
d24627e
fix: add pull-requests read permission for check runs
devin-ai-integration[bot] Jan 23, 2025
4d0255e
revert to prev ubuntu runner
aaronsteers Jan 23, 2025
dff6d82
ci: add GH_TOKEN env var to GitHub CLI steps
devin-ai-integration[bot] Jan 23, 2025
5002a3c
Merge remote changes and add GH_TOKEN env var to GitHub CLI steps
devin-ai-integration[bot] Jan 23, 2025
5ac6578
fix: add URL encoding for check run details_url
devin-ai-integration[bot] Jan 23, 2025
ef68dd3
fix: improve error handling and logging for check run updates
devin-ai-integration[bot] Jan 23, 2025
812e613
feat: create separate test report check runs with alphabetical sorting
devin-ai-integration[bot] Jan 23, 2025
a50aedb
feat: simplify check runs to create separate test reports
devin-ai-integration[bot] Jan 23, 2025
47359b8
ci: add dummy check result workflow for testing check run creation
devin-ai-integration[bot] Jan 23, 2025
6e0613d
fix: correct JSON output format in dummy check result workflow
devin-ai-integration[bot] Jan 23, 2025
ab08f2b
fix: use raw-field for JSON output in check run API calls
devin-ai-integration[bot] Jan 23, 2025
c5daa88
fix: use file-based JSON payload for check run API calls
devin-ai-integration[bot] Jan 23, 2025
e4f431b
fix: use jq to properly format JSON output for check runs
devin-ai-integration[bot] Jan 23, 2025
210552b
ci: switch to GitHub Checks action for check run creation
devin-ai-integration[bot] Jan 23, 2025
cc29626
Apply suggestions from code review
aaronsteers Jan 23, 2025
b13e19d
ci: rename check runs to avoid collisions with job-level checks
devin-ai-integration[bot] Jan 23, 2025
f417ad5
ci: simplify dummy workflow to single failure check
devin-ai-integration[bot] Jan 23, 2025
56856d7
ci: use separate custom check run name to avoid job name conflicts
devin-ai-integration[bot] Jan 23, 2025
c5bf0c8
ci: split check run creation into separate jobs
devin-ai-integration[bot] Jan 23, 2025
09ad54b
ci: simplify to direct API calls for check run creation
devin-ai-integration[bot] Jan 24, 2025
242a23a
fix: properly format JSON output for check run API
devin-ai-integration[bot] Jan 24, 2025
79003a2
ci: simplify to GitHub Checks action for check run creation
devin-ai-integration[bot] Jan 24, 2025
bf16122
ci: use independent check run name to avoid conflicts
devin-ai-integration[bot] Jan 24, 2025
6e19ef8
ci: try post-job check run creation to preserve details URL
devin-ai-integration[bot] Jan 24, 2025
b250851
ci: test neutral conclusion status for check run URL
devin-ai-integration[bot] Jan 24, 2025
f25e728
ci: simplify dummy workflow to single failure check with clear URL note
devin-ai-integration[bot] Jan 24, 2025
8ef33b7
ci: test custom PAT for check run details URL
devin-ai-integration[bot] Jan 24, 2025
4879558
ci: switch to commit status API for custom URLs
devin-ai-integration[bot] Jan 24, 2025
e3c511d
ci: integrate commit status API for test report URLs
devin-ai-integration[bot] Jan 24, 2025
d4b3483
ci: update commit status naming conventions for better organization
devin-ai-integration[bot] Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 69 additions & 3 deletions .github/workflows/connector-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# Forked PRs are handled by the community_ci.yml workflow
# If the condition is not met the job will be skipped (it will not fail)
# runs-on: connector-test-large
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04 # Ubuntu 24 doesn't work as of now
timeout-minutes: 360 # 6 hours
strategy:
fail-fast: false
Expand Down Expand Up @@ -93,9 +93,11 @@ jobs:
- connector: source-pokeapi
cdk_extra: n/a

name: "Check: '${{matrix.connector}}' (skip=${{needs.cdk_changes.outputs['src'] == 'false' || needs.cdk_changes.outputs[matrix.cdk_extra] == 'false'}})"
name: "${{matrix.connector}} Connector Job (skip=${{needs.cdk_changes.outputs['src'] == 'false' || needs.cdk_changes.outputs[matrix.cdk_extra] == 'false'}})"
permissions:
checks: write
contents: write # Required for creating commit statuses
pull-requests: read
steps:
- name: Abort if extra not changed (${{matrix.cdk_extra}})
id: no_changes
Expand Down Expand Up @@ -123,10 +125,12 @@ jobs:
repository: airbytehq/airbyte
ref: master
path: airbyte
token: ${{ github.token }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
# Initial status will be created by the job itself
- name: Test Connector
if: steps.no_changes.outputs.status != 'cancelled'
timeout-minutes: 90
Expand All @@ -151,12 +155,36 @@ jobs:
if: always() && steps.no_changes.outputs.status != 'cancelled'
run: |
# save job output json file as ci step output
json_output_file=$(find airbyte/airbyte-ci/connectors/pipelines/pipeline_reports -name 'output.json' -print -quit)
mkdir -p airbyte/airbyte-ci/connectors/pipelines/pipeline_reports
echo "Debug: Searching for output.json in pipeline reports directory"
find airbyte/airbyte-ci/connectors/pipelines/pipeline_reports -type f -ls

json_output_file=$(find airbyte/airbyte-ci/connectors/pipelines/pipeline_reports -name 'output.json' -print -quit || true)
echo "Debug: Found output.json at: ${json_output_file}"

if [ -z "$json_output_file" ] || [ ! -f "$json_output_file" ]; then
echo "No output.json found - test may have failed to generate report"
echo "## Job Output for ${{matrix.connector}}" >> $GITHUB_STEP_SUMMARY
echo "- Test failed to generate report" >> $GITHUB_STEP_SUMMARY
echo "::error::Test failed for connector '${{ matrix.connector }}' - no output report generated"
exit 1
fi

echo "Debug: Contents of output.json:"
cat ${json_output_file}

job_output=$(cat ${json_output_file})
success=$(echo ${job_output} | jq -r '.success')
failed_step=$(echo ${job_output} | jq -r '.failed_steps | select(length > 0) | .[0] // "None"')
run_duration=$(echo ${job_output} | jq -r '.run_duration')
html_report_url=$(echo ${job_output} | jq -r '.html_report_url')

echo "Debug: Extracted values from output.json:"
echo "- Success: ${success}"
echo "- Failed Step: ${failed_step}"
echo "- Run Duration: ${run_duration}"
echo "- HTML Report URL: ${html_report_url}"

echo "## Job Output for ${{matrix.connector}}" >> $GITHUB_STEP_SUMMARY
echo "- [HTML Report](${html_report_url})" >> $GITHUB_STEP_SUMMARY
echo "- Success: ${success}" >> $GITHUB_STEP_SUMMARY
Expand All @@ -170,8 +198,46 @@ jobs:
exit 1
fi
echo "See the execution report for details: ${html_report_url}"

echo "Debug: Setting outputs for other steps"
echo "success=${success}" >> $GITHUB_OUTPUT
echo "html_report_url=${html_report_url}" >> $GITHUB_OUTPUT

echo "Debug: Current GITHUB_OUTPUT contents:"
cat $GITHUB_OUTPUT

# Update the test report check run with results
- name: Create Test Report Status
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome == 'success'
env:
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
run: |
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
repos/${{ github.repository }}/statuses/$HEAD_SHA \
-f state="${{ steps.evaluate_output.outputs.success == 'true' && 'success' || 'failure' }}" \
-f target_url="${{ steps.evaluate_output.outputs.html_report_url }}" \
-f description="Click Details to view the test report" \
-f context="${{ matrix.connector }} Test Report"

# Create failure status if report generation failed
- name: Create Report Generation Failed Status
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome != 'success'
env:
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
run: |
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
repos/${{ github.repository }}/statuses/$HEAD_SHA \
-f state="failure" \
-f description="Test execution failed to generate a report" \
-f context="${{ matrix.connector }} Test Report"

# Upload the job output to the artifacts
- name: Upload Job Output
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/dummy_check_result.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Dummy Commit Status

on:
pull_request:
branches:
- main
paths:
- '.github/workflows/dummy_check_result.yml'

jobs:
failure_status:
name: "Dummy Status (fail)"
runs-on: ubuntu-22.04
permissions:
contents: write # Required for creating commit statuses
steps:
- name: Create Failure Status
env:
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
run: |
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
repos/${{ github.repository }}/statuses/$HEAD_SHA \
-f state="failure" \
-f target_url="https://www.google.com/search?q=failed" \
-f description="Click Details to view the test report" \
-f context="Dummy Connector Test Report"
1 change: 1 addition & 0 deletions airbyte_cdk/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
)
from airbyte_cdk.utils.airbyte_secrets_utils import filter_secrets


LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
Expand Down
Loading