Skip to content

Commit 3882377

Browse files
authored
CI-nightly: run E2E test in separate job (cvat-ai#92)
1 parent ec75609 commit 3882377

File tree

2 files changed

+155
-45
lines changed

2 files changed

+155
-45
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
key: ${{ runner.os }}-build-ui-${{ needs.search_cache.outputs.sha }}
102102

103103
- name: Set up Docker Buildx
104-
uses: docker/setup-buildx-action@master
104+
uses: docker/setup-buildx-action@v2
105105

106106
- name: Building CVAT UI image
107107
uses: docker/build-push-action@v2
@@ -192,7 +192,7 @@ jobs:
192192
key: ${{ runner.os }}-build-ui-${{ needs.search_cache.outputs.sha }}
193193

194194
- name: Set up Docker Buildx
195-
uses: docker/setup-buildx-action@master
195+
uses: docker/setup-buildx-action@v2
196196

197197
- name: Building CVAT UI image
198198
uses: docker/build-push-action@v2

.github/workflows/schedule.yml

+153-43
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
schedule:
44
- cron: '0 22 * * *'
55
workflow_dispatch:
6+
7+
env:
8+
SERVER_IMAGE_TEST_REPO: cvat_server
9+
610
jobs:
711
check_updates:
812
runs-on: ubuntu-latest
@@ -64,43 +68,61 @@ jobs:
6468
echo ::set-output name=default_branch::${DEFAULT_BRANCH}
6569
echo ::set-output name=sha::${SHA}
6670
67-
run_tests:
71+
build:
6872
needs: search_cache
6973
runs-on: ubuntu-latest
7074
steps:
7175
- uses: actions/checkout@v2
7276

73-
- uses: actions/setup-node@v2
74-
with:
75-
node-version: '16.x'
76-
77-
- uses: actions/setup-python@v2
77+
- name: Login to Docker Hub
78+
uses: docker/login-action@v2
7879
with:
79-
python-version: '3.8'
80+
username: ${{ secrets.DOCKERHUB_USERNAME }}
81+
password: ${{ secrets.DOCKERHUB_TOKEN }}
8082

81-
- name: Getting CVAT server cache from the default branch
83+
- name: CVAT server. Getting cache from the default branch
8284
uses: actions/cache@v3
8385
with:
8486
path: /tmp/cvat_cache_server
8587
key: ${{ runner.os }}-build-server-${{ needs.search_cache.outputs.sha }}
8688

87-
- name: Getting CVAT UI cache from the default branch
88-
uses: actions/cache@v3
89+
- name: CVAT server. Extract metadata (tags, labels) for Docker
90+
id: meta-server
91+
uses: docker/metadata-action@master
8992
with:
90-
path: /tmp/cvat_cache_ui
91-
key: ${{ runner.os }}-build-ui-${{ needs.search_cache.outputs.sha }}
93+
images: ${{ secrets.DOCKERHUB_WORKSPACE }}/${{ env.SERVER_IMAGE_TEST_REPO }}
9294

9395
- name: Set up Docker Buildx
9496
uses: docker/setup-buildx-action@v2
9597

96-
- name: Building CVAT server image
97-
uses: docker/build-push-action@v2
98+
- name: CVAT server. Build and push
99+
uses: docker/build-push-action@v3
98100
with:
99-
context: .
100-
file: ./Dockerfile
101101
cache-from: type=local,src=/tmp/cvat_cache_server
102-
tags: openvino/cvat_server:latest
103-
load: true
102+
context: .
103+
file: Dockerfile
104+
push: true
105+
tags: ${{ steps.meta-server.outputs.tags }}
106+
labels: ${{ steps.meta-server.outputs.labels }}
107+
108+
unit_testing:
109+
needs: build
110+
runs-on: ubuntu-latest
111+
steps:
112+
- uses: actions/checkout@v2
113+
114+
- uses: actions/setup-python@v2
115+
with:
116+
python-version: '3.8'
117+
118+
- name: Set up Docker Buildx
119+
uses: docker/setup-buildx-action@v2
120+
121+
- name: Getting CVAT UI cache from the default branch
122+
uses: actions/cache@v3
123+
with:
124+
path: /tmp/cvat_cache_ui
125+
key: ${{ runner.os }}-build-ui-${{ needs.search_cache.outputs.sha }}
104126

105127
- name: Building CVAT UI image
106128
uses: docker/build-push-action@v2
@@ -111,6 +133,23 @@ jobs:
111133
tags: openvino/cvat_ui:latest
112134
load: true
113135

136+
- name: CVAT server. Extract metadata (tags, labels) for Docker
137+
id: meta-server
138+
uses: docker/metadata-action@master
139+
with:
140+
images: ${{ secrets.DOCKERHUB_WORKSPACE }}/${{ env.SERVER_IMAGE_TEST_REPO }}
141+
142+
- name: Login to Docker Hub
143+
uses: docker/login-action@v2
144+
with:
145+
username: ${{ secrets.DOCKERHUB_USERNAME }}
146+
password: ${{ secrets.DOCKERHUB_TOKEN }}
147+
148+
- name: Pull CVAT server image
149+
run: |
150+
docker pull ${{ steps.meta-server.outputs.tags }}
151+
docker tag ${{ steps.meta-server.outputs.tags }} openvino/cvat_server
152+
114153
- name: OPA tests
115154
run: |
116155
curl -L -o opa https://openpolicyagent.org/downloads/v0.34.2/opa_linux_amd64_static
@@ -136,17 +175,67 @@ jobs:
136175
137176
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml down -v
138177
178+
e2e_testing:
179+
needs: build
180+
runs-on: ubuntu-latest
181+
steps:
182+
- uses: actions/checkout@v2
183+
184+
- uses: actions/setup-node@v2
185+
with:
186+
node-version: '16.x'
187+
188+
- name: Set up Docker Buildx
189+
uses: docker/setup-buildx-action@v2
190+
191+
- name: Getting CVAT UI cache from the default branch
192+
uses: actions/cache@v3
193+
with:
194+
path: /tmp/cvat_cache_ui
195+
key: ${{ runner.os }}-build-ui-${{ needs.search_cache.outputs.sha }}
196+
197+
- name: Building CVAT UI image
198+
uses: docker/build-push-action@v2
199+
with:
200+
context: .
201+
file: ./Dockerfile.ui
202+
cache-from: type=local,src=/tmp/cvat_cache_ui
203+
tags: openvino/cvat_ui:latest
204+
load: true
205+
206+
- name: CVAT server. Extract metadata (tags, labels) for Docker
207+
id: meta-server
208+
uses: docker/metadata-action@master
209+
with:
210+
images: ${{ secrets.DOCKERHUB_WORKSPACE }}/${{ env.SERVER_IMAGE_TEST_REPO }}
211+
212+
- name: Login to Docker Hub
213+
uses: docker/login-action@v2
214+
with:
215+
username: ${{ secrets.DOCKERHUB_USERNAME }}
216+
password: ${{ secrets.DOCKERHUB_TOKEN }}
217+
218+
- name: Pull CVAT server image
219+
run: |
220+
docker pull ${{ steps.meta-server.outputs.tags }}
221+
docker tag ${{ steps.meta-server.outputs.tags }} openvino/cvat_server
222+
139223
- name: Instrumentation of the code then rebuilding the CVAT UI
140224
run: |
141225
npm ci
142226
npm run coverage
143227
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml build cvat_ui
144228
145-
- name: End-to-end. Run CVAT instance
229+
- name: Run CVAT instance
146230
run: |
147-
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f ./tests/docker-compose.email.yml -f tests/docker-compose.file_share.yml -f components/serverless/docker-compose.serverless.yml up -d
148-
149-
- name: End-to-end. Waiting for server
231+
docker-compose \
232+
-f docker-compose.yml \
233+
-f docker-compose.dev.yml \
234+
-f ./tests/docker-compose.email.yml \
235+
-f tests/docker-compose.file_share.yml \
236+
-f components/serverless/docker-compose.serverless.yml up -d
237+
238+
- name: Waiting for server
150239
id: wait-server
151240
env:
152241
API_ABOUT_PAGE: "localhost:8080/api/server/about"
@@ -176,22 +265,41 @@ jobs:
176265
script: |
177266
core.setFailed('Workflow failed: incorrect response from server. See logs artifact to get more info')
178267
179-
- name: End-to-end. Add user for tests
268+
- name: Add user for tests
180269
env:
181270
DJANGO_SU_NAME: "admin"
182271
DJANGO_SU_EMAIL: "[email protected]"
183272
DJANGO_SU_PASSWORD: "12qwaszx"
184273
run: |
185274
docker exec -i cvat /bin/bash -c "echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${DJANGO_SU_NAME}', '${DJANGO_SU_EMAIL}', '${DJANGO_SU_PASSWORD}')\" | python3 ~/manage.py shell"
186275
187-
- name: End-to-end. Run tests
276+
- name: Run tests
188277
run: |
189278
cd ./tests
190279
npm ci
191-
npm run cypress:run:chrome
192-
mv ./.nyc_output/out.json ./.nyc_output/out_2d.json
193-
npm run cypress:run:chrome:canvas3d
194-
mv ./.nyc_output/out.json ./.nyc_output/out_3d.json
280+
281+
TESTS_3D=('canvas3d_functionality' 'canvas3d_functionality_2')
282+
for testset in ${TESTS_3D[@]};
283+
do
284+
npx cypress run \
285+
--headed \
286+
--config-file cypress_canvas3d.json \
287+
--browser chrome \
288+
--spec 'cypress/integration/${testset}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
289+
mv ./.nyc_output/out.json ./.nyc_output/out_$testset.json
290+
done
291+
292+
TESTS=('actions_tasks' 'actions_tasks2' 'actions_tasks3' \
293+
'actions_objects' 'actions_objects2' 'actions_users' \
294+
'actions_projects_models' 'actions_organizations' 'issues_prs' \
295+
'issues_prs2' 'canvas3d_functionality' 'canvas3d_functionality_2')
296+
for testset in ${TESTS[@]};
297+
do
298+
npx cypress run \
299+
--browser chrome \
300+
--spec 'cypress/integration/${testset}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
301+
mv ./.nyc_output/out.json ./.nyc_output/out_$testset.json
302+
done
195303
196304
- name: Creating a log file from "cvat" container logs
197305
if: failure()
@@ -223,27 +331,29 @@ jobs:
223331
224332
coveralls:
225333
runs-on: ubuntu-latest
226-
needs: run_tests
334+
needs: [unit_testing, e2e_testing]
227335
steps:
228336
- uses: actions/checkout@v2
229337

230-
- name: Getting CVAT server cache from the default branch
231-
uses: actions/cache@v3
232-
with:
233-
path: /tmp/cvat_cache_server
234-
key: ${{ runner.os }}-build-server-${{ needs.search_cache.outputs.sha }}
235-
236338
- name: Set up Docker Buildx
237-
uses: docker/setup-buildx-action@v1.1.2
339+
uses: docker/setup-buildx-action@2
238340

239-
- name: Building CVAT server image
240-
uses: docker/build-push-action@v2
341+
- name: CVAT server. Extract metadata (tags, labels) for Docker
342+
id: meta-server
343+
uses: docker/metadata-action@master
241344
with:
242-
context: .
243-
file: ./Dockerfile
244-
cache-from: type=local,src=/tmp/cvat_cache_server
245-
tags: openvino/cvat_server:latest
246-
load: true
345+
images: ${{ secrets.DOCKERHUB_WORKSPACE }}/${{ env.SERVER_IMAGE_TEST_REPO }}
346+
347+
- name: Login to Docker Hub
348+
uses: docker/login-action@v2
349+
with:
350+
username: ${{ secrets.DOCKERHUB_USERNAME }}
351+
password: ${{ secrets.DOCKERHUB_TOKEN }}
352+
353+
- name: Pull CVAT server image
354+
run: |
355+
docker pull ${{ steps.meta-server.outputs.tags }}
356+
docker tag ${{ steps.meta-server.outputs.tags }} openvino/cvat_server
247357
248358
- name: Downloading coverage results
249359
uses: actions/download-artifact@v2

0 commit comments

Comments
 (0)