Skip to content

Commit 6e71dc0

Browse files
authored
ci: use new --use-local-cdk method for testing connectors (#40)
1 parent 5439b17 commit 6e71dc0

File tree

2 files changed

+56
-13
lines changed

2 files changed

+56
-13
lines changed

.github/workflows/connector-tests.yml

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
fail-fast: false
6969
matrix:
7070
include:
71+
- connector: source-faker
72+
cdk_extra: n/a
7173
- connector: source-shopify
7274
cdk_extra: n/a
7375
# Currently not passing CI (unrelated)
@@ -87,31 +89,66 @@ jobs:
8789
if: ${{ matrix.cdk_extra != 'n/a' && needs.cdk_changes.outputs[matrix.cdk_extra] == 'false' }}
8890
run: |
8991
echo "Aborting job as specified extra not changed: ${{matrix.cdk_extra}} = ${{ needs.cdk_changes.outputs[matrix.cdk_extra] }}"
92+
echo "> Skipped '${{matrix.connector}}' (no relevant changes)" >> $GITHUB_STEP_SUMMARY
9093
echo "status=cancelled" >> $GITHUB_OUTPUT
91-
exit 1
94+
exit 0
9295
continue-on-error: true
9396
# Get the monorepo so we can test the connectors
9497
- name: Checkout CDK
95-
if: steps.no_changes.outcome != 'failure'
98+
if: steps.no_changes.outputs.status != 'cancelled'
9699
uses: actions/checkout@v4
97100
with:
98101
path: airbyte-python-cdk
99102
- name: Checkout Airbyte Monorepo
100103
uses: actions/checkout@v4
101-
if: steps.no_changes.outcome != 'failure'
104+
if: steps.no_changes.outputs.status != 'cancelled'
102105
with:
103106
repository: airbytehq/airbyte
104-
ref: master
107+
# TODO: Revert to `master` after Airbyte CI released:
108+
ref: aj/airbyte-ci/update-python-local-cdk-code
105109
path: airbyte
106110
- name: Test Connector
107-
if: steps.no_changes.outcome != 'failure'
111+
if: steps.no_changes.outputs.status != 'cancelled'
108112
timeout-minutes: 90
109113
env:
110114
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
115+
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
116+
# TODO: Revert below to use `tools.airbyte-ci-binary.install` after Airbyte CI released:
111117
run: |
112118
cd airbyte
113-
make tools.airbyte-ci-binary.install
114-
airbyte-ci connectors \
119+
make tools.airbyte-ci-dev.install
120+
airbyte-ci-dev connectors \
115121
--name ${{matrix.connector}} \
116-
test
117-
--global-status-check-context='Connectors Test: ${{matrix.connector}}'
122+
--use-local-cdk \
123+
test \
124+
--fail-fast \
125+
--skip-step qa_checks \
126+
--skip-step connector_live_tests
127+
128+
# Upload the job output to the artifacts
129+
- name: Upload Job Output
130+
id: upload_job_output
131+
if: always() && steps.no_changes.outputs.status != 'cancelled'
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: ${{matrix.connector}}-job-output
135+
path: airbyte/airbyte-ci/connectors/pipelines/pipeline_reports
136+
137+
- name: Evaluate Job Output
138+
if: always() && steps.no_changes.outputs.status != 'cancelled'
139+
run: |
140+
# save job output json file as ci step output
141+
json_output_file=$(find airbyte/airbyte-ci/connectors/pipelines/pipeline_reports -name 'output.json' -print -quit)
142+
job_output=$(cat ${json_output_file})
143+
success=$(echo ${job_output} | jq -r '.success')
144+
failed_jobs=$(echo ${job_output} | jq -r '.failed_steps')
145+
run_duration=$(echo ${job_output} | jq -r '.run_duration')
146+
echo "## Job Output for ${{matrix.connector}}" >> $GITHUB_STEP_SUMMARY
147+
echo "- Success: ${success}" >> $GITHUB_STEP_SUMMARY
148+
echo "- Test Duration: $(printf "%.0f" ${run_duration})s" >> $GITHUB_STEP_SUMMARY
149+
echo "- Failed Checks: ${failed_jobs}" >> $GITHUB_STEP_SUMMARY
150+
echo -e "\n[Download Job Output](${{steps.upload_job_output.outputs.artifact-url}})" >> $GITHUB_STEP_SUMMARY
151+
if [ "${success}" != "true" ]; then
152+
# Throw failure if tests failed
153+
exit 1
154+
fi

airbyte_cdk/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,18 @@
282282
"StreamSlice",
283283
]
284284

285-
__version__ = _dunamai.get_version(
286-
"airbyte-cdk",
287-
third_choice=_dunamai.Version.from_any_vcs,
288-
).serialize()
285+
__version__: str
289286
"""Version generated by poetry dynamic versioning during publish.
290287
291288
When running in development, dunamai will calculate a new prerelease version
292289
from existing git release tag info.
293290
"""
291+
292+
try:
293+
__version__ = _dunamai.get_version(
294+
"airbyte-cdk",
295+
third_choice=_dunamai.Version.from_any_vcs,
296+
fallback=_dunamai.Version("0.0.0+dev"),
297+
).serialize()
298+
except:
299+
__version__ = "0.0.0+dev"

0 commit comments

Comments
 (0)