Skip to content

Commit 06d91e7

Browse files
alafanechereMarius Posta
and
Marius Posta
authored
airbyte-cdk [python]: re-enable tests in CI (#35560)
Co-authored-by: Marius Posta <[email protected]>
1 parent 7737816 commit 06d91e7

File tree

2 files changed

+151
-3
lines changed

2 files changed

+151
-3
lines changed

.github/workflows/gradle.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
runs-on: ubuntu-latest
2525
outputs:
2626
java: ${{ steps.changes.outputs.java }}
27-
python_cdk: ${{ steps.changes.outputs.python_cdk }}
2827

2928
steps:
3029
- name: Checkout Airbyte
@@ -39,8 +38,7 @@ jobs:
3938
- '**/*.java'
4039
- '**/*.gradle'
4140
- 'airbyte-cdk/java/**/*'
42-
python_cdk:
43-
- 'airbyte-cdk/python/**/*'
41+
4442
run-check:
4543
needs:
4644
- changes
+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# THIS WORKFLOW SHOULD BE REPLACED BY A CLEANER ONE ONCE THE PYTHON CDK TESTS CAN BE RUN WITH POETRY
2+
name: Python CDK Tests
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
env:
9+
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
10+
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
11+
12+
on:
13+
workflow_dispatch:
14+
push:
15+
branches:
16+
- master
17+
pull_request:
18+
types:
19+
- opened
20+
- reopened
21+
- synchronize
22+
23+
jobs:
24+
changes:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
python_cdk: ${{ steps.changes.outputs.python_cdk }}
28+
steps:
29+
- name: Checkout Airbyte
30+
if: github.event_name != 'pull_request'
31+
uses: actions/checkout@v3
32+
- id: changes
33+
uses: dorny/paths-filter@v2
34+
with:
35+
# Note: expressions within a filter are OR'ed
36+
filters: |
37+
python_cdk:
38+
- 'airbyte-cdk/python/**/*'
39+
run-python-cdk-check:
40+
needs:
41+
- changes
42+
if: needs.changes.outputs.python_cdk == 'true'
43+
runs-on: connector-test-large
44+
name: Python CDK Tests
45+
timeout-minutes: 30
46+
steps:
47+
- name: Checkout Airbyte
48+
uses: actions/checkout@v3
49+
- uses: actions/setup-java@v3
50+
with:
51+
distribution: "zulu"
52+
java-version: "21"
53+
- name: Install Pip
54+
run: curl -fsSL https://bootstrap.pypa.io/get-pip.py | python3
55+
- name: Install Pyenv
56+
run: python3 -m pip install virtualenv --user
57+
- name: cd airbyte-cdk/python
58+
run: cd airbyte-cdk/python
59+
- name: Run Gradle Check on Python CDK
60+
uses: burrunan/gradle-cache-action@v1
61+
env:
62+
CI: true
63+
with:
64+
job-id: python-cdk-check
65+
read-only: ${{ github.ref != 'refs/heads/master' }}
66+
gradle-distribution-sha-256-sum-warning: false
67+
concurrent: true
68+
arguments: --scan build
69+
70+
set-instatus-incident-on-failure:
71+
name: Create Instatus Incident on Failure
72+
runs-on: ubuntu-latest
73+
needs:
74+
- run-python-cdk-check
75+
if: ${{ failure() && github.ref == 'refs/heads/master' }}
76+
steps:
77+
- name: Call Instatus Webhook
78+
uses: joelwmale/webhook-action@master
79+
with:
80+
url: ${{ secrets.INSTATUS_CONNECTOR_CI_WEBHOOK_URL }}
81+
body: '{ "trigger": "down", "status": "HASISSUES" }'
82+
83+
set-instatus-incident-on-success:
84+
name: Create Instatus Incident on Success
85+
runs-on: ubuntu-latest
86+
needs:
87+
- run-python-cdk-check
88+
if: ${{ success() && github.ref == 'refs/heads/master' }}
89+
steps:
90+
- name: Call Instatus Webhook
91+
uses: joelwmale/webhook-action@master
92+
with:
93+
url: ${{ secrets.INSTATUS_CONNECTOR_CI_WEBHOOK_URL }}
94+
body: '{ "trigger": "up" }'
95+
96+
notify-failure-slack-channel:
97+
name: "Notify Slack Channel on Build Failures"
98+
runs-on: ubuntu-latest
99+
needs:
100+
- run-python-cdk-check
101+
if: ${{ failure() && github.ref == 'refs/heads/master' }}
102+
steps:
103+
- name: Checkout Airbyte
104+
uses: actions/checkout@v3
105+
- name: Match GitHub User to Slack User
106+
id: match-github-to-slack-user
107+
uses: ./.github/actions/match-github-to-slack-user
108+
env:
109+
AIRBYTE_TEAM_BOT_SLACK_TOKEN: ${{ secrets.SLACK_AIRBYTE_TEAM_READ_USERS }}
110+
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
- name: Publish to OSS Build Failure Slack Channel
112+
uses: abinoda/slack-action@master
113+
env:
114+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
115+
with:
116+
args: >-
117+
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
118+
{\"type\":\"divider\"},
119+
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" Merge to OSS Master failed! :bangbang: \n\n\"}},
120+
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
121+
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"<@${{ steps.match-github-to-slack-user.outputs.slack_user_ids }}> \n\"}},
122+
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-shocked: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-shocked: \n\"}},
123+
{\"type\":\"divider\"}]}
124+
125+
notify-failure-slack-channel-fixed-broken-build:
126+
name: "Notify Slack Channel on Build Fixes"
127+
runs-on: ubuntu-latest
128+
needs:
129+
- run-python-cdk-check
130+
if: success()
131+
steps:
132+
- name: Get Previous Workflow Status
133+
uses: Mercymeilya/[email protected]
134+
id: last_status
135+
with:
136+
github_token: ${{ secrets.GITHUB_TOKEN }}
137+
# To avoid clogging up the channel, only publish build success if the previous build was a failure since this means the build was fixed.
138+
- name: Publish Build Fixed Message to OSS Build Failure Slack Channel
139+
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
140+
uses: abinoda/slack-action@master
141+
env:
142+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
143+
with:
144+
args: >-
145+
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
146+
{\"type\":\"divider\"},
147+
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" OSS Master Fixed! :white_check_mark: \n\n\"}},
148+
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
149+
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-rocket: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-rocket: \n\"}},
150+
{\"type\":\"divider\"}]}

0 commit comments

Comments
 (0)