forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 1
465 lines (418 loc) · 18.1 KB
/
gradle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
name: Airbyte Connectors & Octavia CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
on:
#ability to start task manually in Web UI
workflow_dispatch:
inputs:
debug_mode:
description: "Enable or disable tmate session for debug during helm ac tests"
type: choice
default: "false"
options:
- "true"
- "false"
required: false
push:
branches:
- master
pull_request:
permissions: write-all
jobs:
# The output of this job is used to trigger the following builds.
changes:
name: "Detect Modified Files"
# The filtering action does not deal with well scheduled events so skip to avoid errors.
# See https://github.com/dorny/paths-filter/issues/100 for more info.
# This is okay this workflow is only scheduled on master, where we want to build everything
# so filtering is not required. Use always() in each start block to force the start task.
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
outputs:
build: ${{ steps.filter.outputs.build }}
cdk: ${{ steps.filter.outputs.cdk }}
cli: ${{ steps.filter.outputs.cli }}
connectors: ${{ steps.filter.outputs.connectors }}
db: ${{ steps.filter.outputs.db }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
# Note, the following glob expression within a filters are ORs.
filters: |
build:
- '.github/**'
- 'buildSrc/**'
- 'tools/**'
- '*.gradle'
- 'deps.toml'
- 'airbyte-config-oss/**'
cdk:
- 'airbyte-cdk/**'
cli:
- 'airbyte-api/**'
- 'octavia-cli/**'
connectors:
- 'airbyte-integrations/bases/**'
- 'airbyte-integrations/connectors-templates/**'
- 'airbyte-connector-test-harnesses/acceptance-test-harness/**'
db:
- 'airbyte-db/**'
# Uncomment to debug.
# changes-output:
# name: "Debug Change Detection Logic"
# needs: changes
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - run: |
# echo '${{ toJSON(needs) }}'
## BUILDS
octavia-cli-build:
needs: changes
runs-on: ubuntu-latest
# Because scheduled builds on master require us to skip the changes job. Use always() to force this to run on master.
if: needs.changes.outputs.cli == 'true' || needs.changes.outputs.build == 'true' || (always() && github.ref == 'refs/heads/master')
name: "Octavia CLI: Build"
timeout-minutes: 90
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# - name: Cache Build Artifacts
# uses: ./.github/actions/cache-build-artifacts
# with:
# cache-key: ${{ secrets.CACHE_VERSION }}
# cache-python: "false"
- uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"
- uses: actions/setup-python@v4
with:
python-version: "3.9"
token: ${{ secrets.GH_PAT_MAINTENANCE_OCTAVIA }}
- name: Set up CI Gradle Properties
run: |
mkdir -p ~/.gradle/
cat > ~/.gradle/gradle.properties <<EOF
org.gradle.jvmargs=-Xmx8g -Xss4m \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
org.gradle.workers.max=8
org.gradle.vfs.watch=false
EOF
- name: Format
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=OCTAVIA_CLI ./gradlew format --scan --info --stacktrace
attempt_limit: 3
attempt_delay: 5000 # in ms
- name: Ensure no file change
run: ./tools/bin/check_for_file_changes
- name: Build
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=OCTAVIA_CLI ./gradlew :octavia-cli:build javadoc --scan
attempt_limit: 3
attempt_delay: 5000 # in ms
- name: Run integration tests
uses: Wandalen/wretry.action@master
with:
command: ./tools/bin/integration_tests_octavia.sh
attempt_limit: 3
attempt_delay: 5000 # in ms
cdk-build:
needs: changes
runs-on: ubuntu-latest
# Because scheduled builds on master require us to skip the changes job. Use always() to force this to run on master.
if: needs.changes.outputs.cdk == 'true' || needs.changes.outputs.build == 'true' || (always() && github.ref == 'refs/heads/master')
name: "Airbyte CDK: Build"
timeout-minutes: 90
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3
- name: Cache Build Artifacts
uses: ./.github/actions/cache-build-artifacts
with:
cache-key: ${{ secrets.CACHE_VERSION }}-cdk
- uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up CI Gradle Properties
run: |
mkdir -p ~/.gradle/
cat > ~/.gradle/gradle.properties <<EOF
org.gradle.jvmargs=-Xmx8g -Xss4m \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
org.gradle.workers.max=8
org.gradle.vfs.watch=false
EOF
- name: Format
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=CDK ./gradlew format --scan --info --stacktrace
attempt_limit: 3
attempt_delay: 5000 # in ms
- name: Commit Formatting Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated Commit - Formatting Changes
commit_user_name: Octavia Squidington III
commit_user_email: [email protected]
- name: Build
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=CDK ./gradlew build --scan
attempt_limit: 3
attempt_delay: 5000 # in ms
# Connectors Base
# In case of self-hosted EC2 errors, remove this block.
start-connectors-base-build-runner:
name: "Connectors Base: Start Build EC2 Runner"
needs:
- changes
# Because scheduled builds on master require us to skip the changes job. Use always() to force this to run on master.
if: |
needs.changes.outputs.build == 'true' || needs.changes.outputs.connectors == 'true' || needs.changes.outputs.db == 'true' || (always() && github.ref == 'refs/heads/master')
timeout-minutes: 10
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3
- name: Check PAT rate limits
run: |
./tools/bin/find_non_rate_limited_PAT \
${{ secrets.GH_PAT_BUILD_RUNNER_OSS }} \
${{ secrets.GH_PAT_BUILD_RUNNER_BACKUP }}
- name: Start AWS Runner
id: start-ec2-runner
uses: ./.github/actions/start-aws-runner
with:
aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
github-token: ${{ env.PAT }}
build-connectors-base:
# In case of self-hosted EC2 errors, removed the `needs` line and switch back to running on ubuntu-latest.
needs: start-connectors-base-build-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-connectors-base-build-runner.outputs.label }} # run the job on the newly created runner
name: "Connectors Base: Build"
timeout-minutes: 90
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# - name: Cache Build Artifacts
# uses: ./.github/actions/cache-build-artifacts
# with:
# cache-key: ${{ secrets.CACHE_VERSION }}-connectors-gradle-build
- uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Pyenv
run: python3 -m pip install virtualenv --user
- name: Install automake
run: apt-get update && apt-get install -y automake build-essential libtool libtool-bin autoconf
- name: Set up CI Gradle Properties
run: |
mkdir -p ~/.gradle/
cat > ~/.gradle/gradle.properties <<EOF
org.gradle.jvmargs=-Xmx8g -Xss4m \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
org.gradle.workers.max=8
org.gradle.vfs.watch=false
EOF
- name: Generate Template scaffold
uses: Wandalen/wretry.action@master
with:
command: ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates --scan
attempt_limit: 3
attempt_delay: 5000 # in ms
# Verify that the only committed file changes will be those made by the build, formatter or processResources
- name: Ensure no file change from code formatting
run: git --no-pager diff && test -z "$(git --no-pager diff)"
- name: Format
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=CONNECTORS_BASE ./gradlew format --scan --info --stacktrace
attempt_limit: 3
attempt_delay: 5000 # in ms
- name: Build
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=CONNECTORS_BASE ./gradlew build --scan
attempt_limit: 3
attempt_delay: 5000 # in ms
- name: Process Resources
uses: Wandalen/wretry.action@master
with:
command: SUB_BUILD=CONNECTORS_BASE ./gradlew :airbyte-config-oss:init-oss:processResources --scan
attempt_limit: 3
attempt_delay: 5000 # in ms
# This is helpful in the case that we change a previously commited generated file to be ignored by git.
- name: Remove any files that have been gitignored
run: git ls-files -i -c --exclude-from=.gitignore | xargs -r git rm --cached
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated Commit - Format and Process Resources Changes
commit_user_name: Octavia Squidington III
commit_user_email: [email protected]
- name: Publish Connectors Base Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
id: connectors-test-results
if: always()
with:
junit_files: "/actions-runner/_work/airbyte/airbyte/*/build/test-results/*/*.xml\n/actions-runner/_work/airbyte/airbyte/*/*/build/test-results/*/*.xml"
comment_mode: failures
json_file: connectors_base_results.json
json_test_case_results: true
check_name: "Connectors Base Test Results"
- name: Setup Google Cloud SDK
if: always()
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.GKE_TEST_SA_KEY }}
export_default_credentials: true
- name: Prep Test Results For GCS
if: always()
run: |
python tools/bin/prep_test_results_for_gcs.py --json connectors_base_results.json --jobid $GITHUB_JOB --runid $GITHUB_RUN_ID
- name: Upload Test Results to GCS
if: always()
run: |
gcs_bucket_name="dev-ab-ci-run-results"
filename=$(echo "${{ fromJSON( steps.connectors-test-results.outputs.json ).check_url }}" | sed 's@.*/@@')
echo "$filename"
gsutil -h "Cache-Control:public" cp connectors_base_results.jsonl "gs://$gcs_bucket_name/oss/$filename.jsonl"
- name: Generate Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: Connectors Base Test Report
# Specify top-level and second-level modules. Note there cannot be a space between the comma.
path: "/actions-runner/_work/airbyte/airbyte/*/build/test-results/*/*.xml,/actions-runner/_work/airbyte/airbyte/*/*/build/test-results/*/*.xml"
reporter: java-junit
fail-on-error: "false"
# In case of self-hosted EC2 errors, remove this block.
stop-connectors-base-build-runner:
name: "Connectors Base: Stop Build EC2 Runner"
timeout-minutes: 10
needs:
- start-connectors-base-build-runner # required to get output from the start-runner job
- build-connectors-base # required to wait when the main job is done
runs-on: ubuntu-latest
# Always is required to stop the runner even if the previous job has errors. However always() runs even if the previous step is skipped.
# Thus, we check for skipped here.
if: ${{ always() && needs.start-connectors-base-build-runner.result != 'skipped'}}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Checkout Airbyte
uses: actions/checkout@v3
- name: Check PAT rate limits
run: |
./tools/bin/find_non_rate_limited_PAT \
${{ secrets.GH_PAT_BUILD_RUNNER_OSS }} \
${{ secrets.GH_PAT_BUILD_RUNNER_BACKUP }}
- name: Stop EC2 runner
uses: supertopher/[email protected]
with:
mode: stop
github-token: ${{ env.PAT }}
label: ${{ needs.start-connectors-base-build-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-connectors-base-build-runner.outputs.ec2-instance-id }}
notify-failure-slack-channel:
name: "Notify Slack Channel on Build Failures"
runs-on: ubuntu-latest
needs:
- build-connectors-base
- octavia-cli-build
if: ${{ failure() && github.ref == 'refs/heads/master' }}
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3
- name: Match GitHub User to Slack User
id: match-github-to-slack-user
uses: ./.github/actions/match-github-to-slack-user
env:
AIRBYTE_TEAM_BOT_SLACK_TOKEN: ${{ secrets.SLACK_AIRBYTE_TEAM_READ_USERS }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to OSS Build Failure Slack Channel
uses: abinoda/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
with:
args: >-
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
{\"type\":\"divider\"},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" Merge to OSS Master failed! :bangbang: \n\n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"<@${{ steps.match-github-to-slack-user.outputs.slack_user_ids }}> \n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-shocked: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-shocked: \n\"}},
{\"type\":\"divider\"}]}
notify-failure-slack-channel-fixed-broken-build:
name: "Notify Slack Channel on Build Fixes"
runs-on: ubuntu-latest
needs:
- build-connectors-base
- octavia-cli-build
if: success()
steps:
- name: Get Previous Workflow Status
uses: Mercymeilya/[email protected]
id: last_status
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# To avoid clogging up the channel, only publish build success if the previous build was a failure since this means the build was fixed.
- name: Publish Build Fixed Message to OSS Build Failure Slack Channel
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
uses: abinoda/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
with:
args: >-
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
{\"type\":\"divider\"},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" OSS Master Fixed! :white_check_mark: \n\n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-rocket: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-rocket: \n\"}},
{\"type\":\"divider\"}]}