Skip to content

Commit 86519d0

Browse files
authored
Merge branch 'main' into patch-1
2 parents 3961049 + b711cd6 commit 86519d0

File tree

208 files changed

+18288
-2239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+18288
-2239
lines changed

.coveragerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ omit =
99

1010
# omit as unimplemented
1111
airbyte_cdk/base_python/cdk/streams/auth/jwt.py
12+
13+
# omit temporary files and test files
14+
/tmp/tmp*.py
15+
unit_tests/*
16+
17+
[paths]
18+
# Reconcile file paths
19+
source =
20+
./
21+
/tmp/

.github/pr-welcome-community.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## 👋 Welcome to the Airbyte Python CDK!
2+
3+
Thank you for your contribution from **{{ .repo_name }}**! We're excited to have you in the Airbyte community.
4+
5+
### Testing This CDK Version
6+
7+
You can test this version of the CDK using the following:
8+
9+
```bash
10+
# Run the CLI from this branch:
11+
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@{{ .branch_name }}#egg=airbyte-python-cdk[dev]' --help
12+
13+
# Update a connector to use the CDK from this branch ref:
14+
cd airbyte-integrations/connectors/source-example
15+
poe use-cdk-branch {{ .branch_name }}
16+
```
17+
18+
### Helpful Resources
19+
20+
- [Contributing Guidelines](https://docs.airbyte.com/contributing-to-airbyte/)
21+
- [CDK API Reference](https://airbytehq.github.io/airbyte-python-cdk/)
22+
23+
### PR Slash Commands
24+
25+
As needed or by request, Airbyte Maintainers can execute the following slash commands on your PR:
26+
27+
- `/autofix` - Fixes most formatting and linting issues
28+
- `/poetry-lock` - Updates poetry.lock file
29+
- `/test` - Runs connector tests with the updated CDK
30+
31+
If you have any questions, feel free to ask in the PR comments or join our [Slack community](https://airbytehq.slack.com/).
32+

.github/pr-welcome-internal.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## 👋 Greetings, Airbyte Team Member!
2+
3+
Here are some helpful tips and reminders for your convenience.
4+
5+
### Testing This CDK Version
6+
7+
You can test this version of the CDK using the following:
8+
9+
```bash
10+
# Run the CLI from this branch:
11+
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@{{ .branch_name }}#egg=airbyte-python-cdk[dev]' --help
12+
13+
# Update a connector to use the CDK from this branch ref:
14+
cd airbyte-integrations/connectors/source-example
15+
poe use-cdk-branch {{ .branch_name }}
16+
```
17+
18+
### Helpful Resources
19+
20+
- [CDK API Reference](https://airbytehq.github.io/airbyte-python-cdk/)
21+
22+
### PR Slash Commands
23+
24+
Airbyte Maintainers can execute the following slash commands on your PR:
25+
26+
- `/autofix` - Fixes most formatting and linting issues
27+
- `/poetry-lock` - Updates poetry.lock file
28+
- `/test` - Runs connector tests with the updated CDK
29+
- `/poe <command>` - Runs any poe command in the CDK environment
30+
31+
[📝 _Edit this welcome message._](https://github.com/airbytehq/airbyte-python-cdk/blob/main/.github/pr-welcome-internal.md)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# When a PR is has the auto-merge feature enabled or disabled, this workflow adds or updates
2+
# warning text at the bottom of the PR description.
3+
4+
name: "Add Auto-Merge Notification Text"
5+
on:
6+
pull_request:
7+
types: [auto_merge_enabled, auto_merge_disabled]
8+
9+
jobs:
10+
update-description:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: write
14+
steps:
15+
- name: Add Auto-Merge Notice
16+
if: github.event.action == 'auto_merge_enabled'
17+
uses: bcgov/[email protected]
18+
with:
19+
add_markdown: |
20+
> [!IMPORTANT]
21+
> **Auto-merge enabled.**
22+
>
23+
> _This PR is set to merge automatically when all requirements are met._
24+
25+
- name: Remove Auto-Merge Notice
26+
if: github.event.action == 'auto_merge_disabled'
27+
uses: bcgov/[email protected]
28+
with:
29+
add_markdown: |
30+
> [!NOTE]
31+
> **Auto-merge may have been disabled. Please check the PR status to confirm.**

.github/workflows/connector-tests.yml

Lines changed: 82 additions & 105 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-22.04
28+
runs-on: ubuntu-24.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-22.04
65+
runs-on: ubuntu-24.04
6666
timeout-minutes: 360 # 6 hours
6767
strategy:
6868
fail-fast: false
@@ -72,28 +72,26 @@ jobs:
7272
cdk_extra: n/a
7373
- connector: source-shopify
7474
cdk_extra: n/a
75-
# Chargebee is being flaky:
76-
# - connector: source-chargebee
77-
# cdk_extra: n/a
78-
# This one is behind in CDK updates and can't be used as tests until it is updated:
79-
# - connector: destination-pinecone
80-
# cdk_extra: vector-db-based
8175
- connector: source-google-drive
8276
cdk_extra: file-based
8377
- connector: destination-motherduck
84-
cdk_extra: sql
85-
# ZenDesk currently failing (as of 2024-12-02)
86-
# TODO: Re-enable once fixed
87-
# - connector: source-zendesk-support
78+
# For now, we mark as 'n/a' to always test this connector
79+
cdk_extra: n/a # change to 'sql' to test less often
80+
# source-amplitude failing for unrelated issue "date too far back"
81+
# e.g. https://github.com/airbytehq/airbyte-python-cdk/actions/runs/16053716569/job/45302638848?pr=639
82+
# - connector: source-amplitude
8883
# cdk_extra: n/a
89-
# TODO: These are manifest connectors and won't work as expected until we
90-
# add `--use-local-cdk` support for manifest connectors.
91-
- connector: source-amplitude
84+
- connector: source-intercom
9285
cdk_extra: n/a
9386
- connector: source-pokeapi
9487
cdk_extra: n/a
9588

96-
name: "Check: '${{matrix.connector}}' (skip=${{needs.cdk_changes.outputs['src'] == 'false' || needs.cdk_changes.outputs[matrix.cdk_extra] == 'false'}})"
89+
# CDK Tests cannot build the Connector object (constructor args not optional).
90+
# - connector: source-zendesk-support
91+
# cdk_extra: n/a
92+
93+
name: "${{ needs.cdk_changes.outputs[matrix.cdk_extra] == 'false' && 'Skipped Check' || 'Check' }}: ${{matrix.connector}}"
94+
if: needs.cdk_changes.outputs['src'] == 'true'
9795
permissions:
9896
checks: write
9997
contents: write # Required for creating commit statuses
@@ -125,110 +123,89 @@ jobs:
125123
repository: airbytehq/airbyte
126124
ref: master
127125
path: airbyte
126+
128127
- name: Set up Python
128+
if: steps.no_changes.outputs.status != 'cancelled'
129129
uses: actions/setup-python@v5
130130
with:
131131
python-version: "3.11"
132-
# Create initial pending status for test report
133-
- name: Create Pending Test Report Status
132+
133+
- name: Set up `uv`
134+
if: steps.no_changes.outputs.status != 'cancelled'
135+
uses: astral-sh/[email protected]
136+
137+
- name: Set up `poe`
138+
if: steps.no_changes.outputs.status != 'cancelled'
139+
run: |
140+
uv tool install poethepoet
141+
142+
- name: Set up Poetry
143+
if: steps.no_changes.outputs.status != 'cancelled'
144+
uses: Gr1N/setup-poetry@v9
145+
with:
146+
poetry-version: "2.0.1"
147+
148+
- name: Get Connector Language
149+
if: steps.no_changes.outputs.status != 'cancelled'
150+
working-directory: airbyte/airbyte-integrations/connectors/${{ matrix.connector }}
151+
run: |
152+
# Get the language of the connector from the metadata file
153+
CONNECTOR_LANGUAGE=$(poe -qq get-language)
154+
echo "CONNECTOR_LANGUAGE=$CONNECTOR_LANGUAGE" | tee -a $GITHUB_ENV
155+
156+
- name: Install CDK with Poetry
134157
if: steps.no_changes.outputs.status != 'cancelled'
135-
env:
136-
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
137158
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-
148-
- name: Test Connector
159+
cd airbyte-python-cdk
160+
poetry install --all-extras
161+
162+
- name: Fetch Connector Secrets
149163
if: steps.no_changes.outputs.status != 'cancelled'
150164
timeout-minutes: 90
165+
working-directory: airbyte-python-cdk
151166
env:
152167
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
153168
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
154169
run: |
155-
cd airbyte
156-
make tools.airbyte-ci-dev.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+
poetry run airbyte-cdk secrets fetch ${{ matrix.connector }}
171+
172+
- name: Bump to Dev Branch CDK [Python Connectors]
173+
if: env.CONNECTOR_LANGUAGE == 'python'
174+
working-directory: airbyte/airbyte-integrations/connectors/${{ matrix.connector }}
170175
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
176+
echo "Using CDK ref ${{ github.event.pull_request.head.sha || github.sha }}"
177+
poe use-cdk-branch ${{ github.event.pull_request.head.sha || github.sha }}
178+
poetry install --all-extras
193179
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'
180+
- name: Run Unit Tests [Python Connectors]
181+
if: env.CONNECTOR_LANGUAGE == 'python'
182+
working-directory: airbyte/airbyte-integrations/connectors/${{ matrix.connector }}
183+
run: |
184+
poe test-unit-tests
185+
186+
- name: Run FAST Standard Tests [Python Connectors]
187+
if: env.CONNECTOR_LANGUAGE == 'python'
188+
working-directory: airbyte/airbyte-integrations/connectors/${{ matrix.connector }}
197189
env:
198-
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
190+
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
191+
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
199192
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'
193+
poetry run airbyte-cdk connector test
194+
195+
- name: Run FAST Standard Tests [Manifest-Only Connectors]
196+
if: env.CONNECTOR_LANGUAGE == 'manifest-only'
197+
working-directory: airbyte-python-cdk
214198
env:
215-
GH_TOKEN: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
199+
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
200+
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
216201
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
202+
poetry run airbyte-cdk connector test ${{ matrix.connector }}
203+
204+
- name: Container Build and Test [All Connectors]
205+
if: steps.no_changes.outputs.status != 'cancelled'
206+
working-directory: airbyte-python-cdk
207+
env:
208+
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
209+
POETRY_DYNAMIC_VERSIONING_BYPASS: "0.0.0"
210+
run: |
211+
poetry run airbyte-cdk image test ${{ matrix.connector }}

.github/workflows/poe-command.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: On-Demand Poe Task
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
comment-id:
7+
description: "Optional comment-id of the slash command. Ignore if not applicable."
8+
required: false
9+
pr:
10+
description: "PR Number"
11+
required: false
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
jobs:
18+
run-poe-command:
19+
env:
20+
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Run Poe Slash Command Processor
24+
uses: aaronsteers/poe-command-processor@v1
25+
with:
26+
pr: ${{ github.event.inputs.pr }}
27+
comment-id: ${{ github.event.inputs.comment-id }}
28+
github-token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}

.github/workflows/pytest_fast.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ jobs:
7070
poetry run coverage html -d htmlcov
7171
poetry run coverage xml -o htmlcov/coverage.xml
7272
73+
- name: Publish Test Results
74+
uses: EnricoMi/publish-unit-test-result-action@v2
75+
if: always() && !cancelled()
76+
continue-on-error: true
77+
with:
78+
check_name: "PyTest Results (Fast)"
79+
large_files: true
80+
files: |
81+
build/test-results/**/*.xml
7382
- name: Upload coverage to GitHub Artifacts
7483
if: always()
7584
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)