Skip to content

Commit c4205ff

Browse files
committed
update workflow to test connectors with cdk standard test framework
1 parent 37fcbd8 commit c4205ff

File tree

1 file changed

+15
-65
lines changed

1 file changed

+15
-65
lines changed

.github/workflows/connector-tests.yml

Lines changed: 15 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ jobs:
9090
# add `--use-local-cdk` support for manifest connectors.
9191
- connector: source-amplitude
9292
cdk_extra: n/a
93+
- connector: source-intercom
94+
cdk_extra: n/a
9395
- connector: source-pokeapi
9496
cdk_extra: n/a
9597

@@ -129,6 +131,15 @@ jobs:
129131
uses: actions/setup-python@v5
130132
with:
131133
python-version: "3.11"
134+
135+
- name: Set up `uv`
136+
uses: astral-sh/[email protected]
137+
138+
- name: Set up Poetry
139+
uses: Gr1N/setup-poetry@v9
140+
with:
141+
poetry-version: "2.0.1"
142+
132143
# Create initial pending status for test report
133144
- name: Create Pending Test Report Status
134145
if: steps.no_changes.outputs.status != 'cancelled'
@@ -148,52 +159,16 @@ jobs:
148159
- name: Test Connector
149160
if: steps.no_changes.outputs.status != 'cancelled'
150161
timeout-minutes: 90
162+
working-directory: airbyte/airbyte-integrations/connectors/${{ matrix.connector }}
151163
env:
152164
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
153165
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
154166
run: |
155-
cd airbyte
156-
make tools.airbyte-ci.install
157-
airbyte-ci \
158-
--ci-report-bucket-name=airbyte-ci-reports-multi \
159-
connectors \
160-
--name ${{matrix.connector}} \
161-
--use-local-cdk \
162-
test \
163-
--fail-fast \
164-
--skip-step qa_checks \
165-
--skip-step connector_live_tests
166-
167-
- name: Evaluate Test
168-
id: evaluate_output
169-
if: always() && steps.no_changes.outputs.status != 'cancelled'
170-
run: |
171-
# save job output json file as ci step output
172-
json_output_file=$(find airbyte/airbyte-ci/connectors/pipelines/pipeline_reports -name 'output.json' -print -quit)
173-
job_output=$(cat ${json_output_file})
174-
success=$(echo ${job_output} | jq -r '.success')
175-
failed_step=$(echo ${job_output} | jq -r '.failed_steps | select(length > 0) | .[0] // "None"')
176-
run_duration=$(echo ${job_output} | jq -r '.run_duration')
177-
html_report_url=$(echo ${job_output} | jq -r '.html_report_url')
178-
echo "## Job Output for ${{matrix.connector}}" >> $GITHUB_STEP_SUMMARY
179-
echo "- [HTML Report](${html_report_url})" >> $GITHUB_STEP_SUMMARY
180-
echo "- Success: ${success}" >> $GITHUB_STEP_SUMMARY
181-
echo "- Test Duration: $(printf "%.0f" ${run_duration})s" >> $GITHUB_STEP_SUMMARY
182-
if [ "${success}" != "true" ]; then
183-
echo "- Failed Step: ${failed_step}" >> $GITHUB_STEP_SUMMARY
184-
fi
185-
echo -e "\n[Download Job Output](${{steps.upload_job_output.outputs.artifact-url}})" >> $GITHUB_STEP_SUMMARY
186-
if [ "${success}" != "true" ]; then
187-
echo "::error::Test failed for connector '${{ matrix.connector }}' on step '${failed_step}'. "
188-
exit 1
189-
fi
190-
echo "See the execution report for details: ${html_report_url}"
191-
echo "success=${success}" >> $GITHUB_OUTPUT
192-
echo "html_report_url=${html_report_url}" >> $GITHUB_OUTPUT
167+
airbyte-cdk connector test ${{matrix.connector}}
193168
194169
# Update the test report status with results
195170
- name: Update Test Report Status
196-
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome == 'success'
171+
if: always() && steps.no_changes.outputs.status != 'cancelled'
197172
env:
198173
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
199174
run: |
@@ -203,32 +178,7 @@ jobs:
203178
-H "Accept: application/vnd.github+json" \
204179
-H "X-GitHub-Api-Version: 2022-11-28" \
205180
repos/${{ github.repository }}/statuses/$HEAD_SHA \
206-
-f state="${{ steps.evaluate_output.outputs.success == 'true' && 'success' || 'failure' }}" \
181+
-f state="${{ job.status }}" \
207182
-f target_url="${{ steps.evaluate_output.outputs.html_report_url }}" \
208183
-f description="Click Details to view the test report" \
209184
-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-
227-
# Upload the job output to the artifacts
228-
- name: Upload Job Output
229-
id: upload_job_output
230-
if: always() && steps.no_changes.outputs.status != 'cancelled'
231-
uses: actions/upload-artifact@v4
232-
with:
233-
name: ${{matrix.connector}}-job-output
234-
path: airbyte/airbyte-ci/connectors/pipelines/pipeline_reports

0 commit comments

Comments
 (0)