forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
325 lines (289 loc) · 11.4 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
name: Airbyte CI
on:
schedule:
- cron: '0 */6 * * *'
push:
jobs:
launch_integration_tests:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout Airbyte
uses: actions/checkout@v2
- name: Launch Integration Tests
run: ./tools/bin/ci_integration_workflow_launcher.sh
env:
GITHUB_TOKEN: ${{ secrets.SLASH_COMMAND_PAT }}
## Gradle Build
# In case of self-hosted EC2 errors, remove the `start-build-runner` block.
start-build-runner:
name: Start Build EC2 Runner
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: 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: Start EC2 Runner
id: start-ec2-runner
uses: machulav/[email protected]
with:
mode: start
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
ec2-image-id: ami-04bd6e81239f4f3fb
ec2-instance-type: c5.2xlarge
subnet-id: subnet-0469a9e68a379c1d3
security-group-id: sg-0793f3c9413f21970
build:
# In case of self-hosted EC2 errors, remove the next two lines and uncomment the currently commented out `runs-on` line.
needs: start-build-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-build-runner.outputs.label }} # run the job on the newly created runner
# runs-on: ubuntu-latest
name: Build Airbyte
steps:
- name: Checkout Airbyte
uses: actions/checkout@v2
- name: Check images exist
run: ./tools/bin/check_images_exist.sh
- name: Pip Caching
uses: actions/cache@v2
with:
path: |
~/.cache/pip
key: ${{ secrets.CACHE_VERSION }}-pip-${{ runner.os }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ secrets.CACHE_VERSION }}-pip-${{ runner.os }}-
- name: Npm Caching
uses: actions/cache@v2
with:
path: |
~/.npm
key: ${{ secrets.CACHE_VERSION }}-npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ secrets.CACHE_VERSION }}-npm-${{ runner.os }}-
# this intentionally does not use restore-keys so we don't mess with gradle caching
- name: Gradle and Python Caching
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
**/.venv
key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements.txt') }}
- uses: actions/setup-java@v1
with:
java-version: '14'
- uses: actions/setup-node@v1
with:
node-version: '14.7'
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Generate Template scaffold
run: ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates --scan
- name: Format
run: ./gradlew --no-daemon format --scan
- name: Ensure no file change
run: git status --porcelain && test -z "$(git status --porcelain)"
- name: Build
run: CORE_ONLY=true ./gradlew --no-daemon build --scan
- name: Ensure no file change
run: git status --porcelain && test -z "$(git status --porcelain)"
- name: Check documentation
if: success() && github.ref == 'refs/heads/master'
run: ./tools/site/link_checker.sh check_docs
- name: Get Docker Space
run: docker run --rm busybox df -h
- name: Build Core Docker Images
if: success() && github.ref == 'refs/heads/master'
run: ./gradlew --no-daemon composeBuild --scan
env:
GIT_REVISION: ${{ github.sha }}
- name: Image Cleanup
run: ./tools/bin/clean_images.sh
# make sure these always run before pushing core docker images
- name: Run End-to-End Acceptance Tests
if: success() && github.ref == 'refs/heads/master'
run: ./tools/bin/acceptance_test.sh
- name: Push Core Docker Images
if: success() && github.ref == 'refs/heads/master'
run: |
docker login -u airbytebot -p ${DOCKER_PASSWORD}
VERSION=dev docker-compose -f docker-compose.build.yaml push
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Slack Notification - Failure
if: failure() && github.ref == 'refs/heads/master'
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.BUILD_SLACK_WEBHOOK }}
SLACK_USERNAME: Buildozer
SLACK_ICON: https://avatars.slack-edge.com/temp/2020-09-01/1342729352468_209b10acd6ff13a649a1.jpg
SLACK_COLOR: DC143C
SLACK_TITLE: "Build failure"
SLACK_FOOTER: ""
- name: Slack Notification - Success
if: success() && github.ref == 'refs/heads/master'
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.BUILD_SLACK_WEBHOOK }}
SLACK_USERNAME: Buildbot
SLACK_TITLE: "Build Success"
SLACK_FOOTER: ""
# In case of self-hosted EC2 errors, remove the `stop-build-runner` block.
stop-build-runner:
name: Stop Build EC2 Runner
needs:
- start-build-runner # required to get output from the start-runner job
- build # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
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: Stop EC2 runner
uses: machulav/[email protected]
with:
mode: stop
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
label: ${{ needs.start-build-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-build-runner.outputs.ec2-instance-id }}
## Acceptance Test
# In case of self-hosted EC2 errors, remove the next two lines and uncomment the currently commented out `runs-on` line.
start-acceptance-test-runner:
name: Start Acceptance Test EC2 Runner
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: 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: Start EC2 runner
id: start-ec2-runner
uses: machulav/[email protected]
with:
mode: start
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
ec2-image-id: ami-04bd6e81239f4f3fb
ec2-instance-type: c5.2xlarge
subnet-id: subnet-0469a9e68a379c1d3
security-group-id: sg-0793f3c9413f21970
acceptance-test:
# In case of self-hosted EC2 errors, remove the next two lines and uncomment the currently commented out `runs-on` line.
needs: start-acceptance-test-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-acceptance-test-runner.outputs.label }} # run the job on the newly created runner
# runs-on: ubuntu-latest
name: Run Acceptance Tests
steps:
- name: Checkout Airbyte
uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '14'
- uses: actions/setup-node@v1
with:
node-version: '14.7'
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Build Core Docker Images and Run Tests
run: CORE_ONLY=true ./gradlew --no-daemon composeBuild test -x :airbyte-webapp:test --scan
env:
GIT_REVISION: ${{ github.sha }}
CORE_ONLY: true
- name: Run Docker End-to-End Acceptance Tests
run: |
./tools/bin/acceptance_test.sh
# In case of self-hosted EC2 errors, remove the `stop-build-runner` block.
stop-acceptance-test-runner:
name: Stop Acceptance Test EC2 Runner
needs:
- start-acceptance-test-runner # required to get output from the start-runner job
- acceptance-test # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
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: Stop EC2 runner
uses: machulav/[email protected]
with:
mode: stop
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
label: ${{ needs.start-acceptance-test-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-acceptance-test-runner.outputs.ec2-instance-id }}
## Frontend Test
frontend-test:
runs-on: ubuntu-latest
name: Run Frontend Test
steps:
- name: Checkout Airbyte
uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '14'
- uses: actions/setup-node@v1
with:
node-version: '14.7'
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Build Core Docker Images and Run Tests
run: CORE_ONLY=true ./gradlew --no-daemon build --scan
- name: Run End-to-End Frontend Tests
run: ./tools/bin/e2e_test.sh
# DISABLED UNTIL WE HAVE TEMPORAL ON KUBE
# test_kube:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Airbyte
# uses: actions/checkout@v2
#
# - uses: actions/setup-java@v1
# with:
# java-version: '14'
#
# - uses: actions/setup-node@v1
# with:
# node-version: '14.7'
#
# - uses: actions/setup-python@v2
# with:
# python-version: '3.7'
#
# - name: Setup Minikube
# uses: manusa/[email protected]
# with:
# minikube version: 'v1.16.0'
# kubernetes version: 'v1.19.2'
#
# - name: Install socat
# run: sudo apt-get install socat
#
# - name: Build Core Docker Images and Run Tests
# run: CORE_ONLY=true ./gradlew --no-daemon composeBuild test -x :airbyte-webapp:test --scan
# env:
# GIT_REVISION: ${{ github.sha }}
# CORE_ONLY: true
#
# - name: Run Kubernetes End-to-End Acceptance Tests
# run: |
# ./tools/bin/acceptance_test_kube.sh