-
Notifications
You must be signed in to change notification settings - Fork 4
276 lines (269 loc) · 10.4 KB
/
e2e-tests.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
# ----------------------------------------------------------------------------
# Copyright (C) 2021-2022 Deepchecks (https://www.deepchecks.com)
#
# This file is part of Deepchecks.
# Deepchecks is distributed under the terms of the GNU Affero General
# Public License (version 3 or later).
# You should have received a copy of the GNU Affero General Public License
# along with Deepchecks. If not, see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------------
#
name: PR Tests
env:
DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY: "true"
on:
pull_request:
branches:
- main
push:
branches:
- main
# Manual run
workflow_dispatch:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
if: "!github.event.pull_request.draft"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
build-args: |
DEEPCHECKS_CI_TOKEN=${{ secrets.DEEPCHECKS_CI_TOKEN }}
MIXPANEL_ID=${{ secrets.MIXPANEL_ID }}
outputs: type=docker,dest=/tmp/commImage.tar
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: commImage
path: /tmp/commImage.tar
docker-push:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Configure AWS credentials (Public)
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
# Sadly, buildx does not support loading images from file to reuse the image from the previous step
# https://github.com/docker/buildx/issues/847
- name: Build and push - private
uses: docker/build-push-action@v4
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64/v8
push: true
tags: |
${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
${{ secrets.MON_IMAGE_NAME }}:latest
build-args: |
DEEPCHECKS_CI_TOKEN=${{ secrets.DEEPCHECKS_CI_TOKEN }}
MIXPANEL_ID=${{ secrets.MIXPANEL_ID }}
- name: Build and push - public
uses: docker/build-push-action@v4
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64/v8
push: true
tags: |
${{ secrets.PUBLIC_IMAGE_NAME }}:${{ github.sha }}
${{ secrets.PUBLIC_IMAGE_NAME }}:latest
build-args: |
DEEPCHECKS_CI_TOKEN=${{ secrets.DEEPCHECKS_CI_TOKEN }}
MIXPANEL_ID=${{ secrets.MIXPANEL_ID }}
IS_DEEPCHECKS_OSS="true"
- name: Logout from Amazon ECR
if: always()
run: |
docker logout ${{ steps.login-ecr.outputs.registry }}
docker logout ${{ steps.login-ecr-public.outputs.registry }}
dev-deploy:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: docker-push
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition mon-commercial --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition - app
id: render-app-container
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: server
image: ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
- name: Fill in the new image ID in the Amazon ECS task definition - alert-scheduler
id: render-alert-scheduler-container
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ steps.render-app-container.outputs.task-definition }}
container-name: alert-scheduler
image: ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
- name: Fill in the new image ID in the Amazon ECS task definition - task queuer
id: render-task-queuer-container
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ steps.render-alert-scheduler-container.outputs.task-definition }}
container-name: task-queuer
image: ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
- name: Fill in the new image ID in the Amazon ECS task definition - task runner
id: render-task-runner-container
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ steps.render-task-queuer-container.outputs.task-definition }}
container-name: task-runner
image: ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.render-task-runner-container.outputs.task-definition }}
service: mon-commercial
cluster: DevMonitoring
e2e:
runs-on: ubuntu-latest-4-cores
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: commImage
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/commImage.tar
docker tag ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }} deepchecks-enterprise-testing
docker image ls -a
- name: Run e2e tests
env:
LAUCHDARKLY_SDK_KEY: ${{ secrets.LAUCHDARKLY_SDK_KEY }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
run: make cypress
- name: Upload artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: cypress-artifacts
path: |
./cypress/screenshots
./cypress/videos
retention-days: 1
docs:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout deepchecks
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install pandoc dvisvgm texlive texlive-latex-extra postgresql-client
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: commImage
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/commImage.tar
docker tag ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }} deepchecks-enterprise-testing
docker image ls -a
- name: Setup environment
run: |
make external-services-setup
- name: DB load
run: |
docker run --env-file e2e/.development.env --network deepchecks deepchecks-enterprise-testing init-test-db.sh
echo "DEEPCHECKS_API_TOKEN=ZTJlLXRlc3RpbmdAZGVlcGNoZWNrcy5jb20=.ASB8rB13J5i_4Nma7zZfIA" >> $GITHUB_ENV
echo "DEEPCHECKS_API_HOST=http://127.0.0.1:8000" >> $GITHUB_ENV
env:
DEEPCHECKS_CI_TOKEN: ${{ secrets.DEEPCHECKS_CI_TOKEN }}
- name: Build documentation
env:
DEEPCHECKS_CI_TOKEN: ${{ secrets.DEEPCHECKS_CI_TOKEN }}
DEEPCHECKS_API_TOKEN: ${{ env.DEEPCHECKS_API_TOKEN }}
DEEPCHECKS_API_HOST: ${{ env.DEEPCHECKS_API_HOST }}
LAUCHDARKLY_SDK_KEY: ${{ secrets.LAUCHDARKLY_SDK_KEY }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
run: |
make env-setup
make docs
# - name: Debugging with ssh
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true
# env:
# DEEPCHECKS_CI_TOKEN: ${{ secrets.DEEPCHECKS_CI_TOKEN }}
# DEEPCHECKS_API_TOKEN: ${{ env.DEEPCHECKS_API_TOKEN }}
# DEEPCHECKS_API_HOST: ${{ env.DEEPCHECKS_API_HOST }}
- name: Print errors
if: always()
run: cat docs/docs.error.log
- name: Print server logs
if: always()
run: docker logs `docker ps | grep :8000 | awk '{print $1}'`
- name: Checkout deepchecks.github.io
if: github.event_name != 'pull_request'
uses: actions/checkout@v2
with:
repository: deepchecks/deepchecks.github.io
path: deepchecks.github.io
token: ${{ secrets.DEEPCHECKS_CI_TOKEN }}
- name: Push documentation
if: github.event_name != 'pull_request'
run: ${{ github.workspace }}/.github/scripts/push_docs.sh