1616 runs-on : ubuntu-latest
1717 steps :
1818 - uses : actions/checkout@v2
19+
1920 - uses : actions/setup-python@v2
2021 with :
2122 python-version : ' 3.8'
23+
2224 - name : Getting SHA from the default branch
2325 id : get-sha
2426 run : |
3638
3739 echo ::set-output name=default_branch::${DEFAULT_BRANCH}
3840 echo ::set-output name=sha::${SHA}
41+
3942 - name : Waiting a cache creation in the default branch
4043 if : ${{ github.ref_name != 'develop' }}
4144 run : |
@@ -69,13 +72,22 @@ jobs:
6972 echo "Number of attempts expired!"
7073 echo "Probably the creation of the cache is not yet complete. Will continue working without the cache."
7174 fi
75+
7276 - name : Getting CVAT server cache from the default branch
7377 uses : actions/cache@v2
7478 with :
7579 path : /tmp/cvat_cache_server
7680 key : ${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }}
81+
82+ - name : Getting CVAT UI cache from the default branch
83+ uses : actions/cache@v2
84+ with :
85+ path : /tmp/cvat_cache_ui
86+ key : ${{ runner.os }}-build-ui-${{ steps.get-sha.outputs.sha }}
87+
7788 - name : Set up Docker Buildx
7889 uses : docker/setup-buildx-action@v1.1.2
90+
7991 - name : Building CVAT server image
8092 uses : docker/build-push-action@v2
8193 with :
@@ -84,11 +96,22 @@ jobs:
8496 cache-from : type=local,src=/tmp/cvat_cache_server
8597 tags : openvino/cvat_server:latest
8698 load : true
99+
100+ - name : Building CVAT UI image
101+ uses : docker/build-push-action@v2
102+ with :
103+ context : .
104+ file : ./Dockerfile.ui
105+ cache-from : type=local,src=/tmp/cvat_cache_ui
106+ tags : openvino/cvat_ui:latest
107+ load : true
108+
87109 - name : Running OPA tests
88110 run : |
89111 curl -L -o opa https://openpolicyagent.org/downloads/v0.34.2/opa_linux_amd64_static
90112 chmod +x ./opa
91113 ./opa test cvat/apps/iam/rules
114+
92115 - name : Running REST API tests
93116 env :
94117 API_ABOUT_PAGE : " localhost:8080/api/server/about"
@@ -98,16 +121,22 @@ jobs:
98121 run : |
99122 docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml -f components/analytics/docker-compose.analytics.yml -f tests/rest_api/docker-compose.minio.yml up -d
100123 /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${API_ABOUT_PAGE})" != "401" ]]; do sleep 5; done'
124+
101125 pip3 install --user -r tests/rest_api/requirements.txt
102- pytest tests/rest_api/
126+ pytest tests/rest_api/ -k 'GET'
127+
103128 docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml -f components/analytics/docker-compose.analytics.yml -f tests/rest_api/docker-compose.minio.yml down -v
129+
104130 - name : Running unit tests
105131 env :
106132 HOST_COVERAGE_DATA_DIR : ${{ github.workspace }}
107133 CONTAINER_COVERAGE_DATA_DIR : " /coverage_data"
108134 run : |
109- docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'coverage run -a manage.py test cvat/apps utils/cli && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}'
110- docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm ci && cd ../cvat-core && npm ci && npm run test && mv ./reports/coverage/lcov.info ${CONTAINER_COVERAGE_DATA_DIR} && chmod a+rwx ${CONTAINER_COVERAGE_DATA_DIR}/lcov.info'
135+ docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash \
136+ -c 'coverage run -a manage.py test cvat/apps utils/cli -k 'tasks_id' -k 'lambda' -k 'share' && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}'
137+
138+ docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash \
139+ -c 'cd cvat-data && npm ci && cd ../cvat-core && npm ci && npm run test && mv ./reports/coverage/lcov.info ${CONTAINER_COVERAGE_DATA_DIR} && chmod a+rwx ${CONTAINER_COVERAGE_DATA_DIR}/lcov.info'
111140 - name : Uploading code coverage results as an artifact
112141 if : github.ref == 'refs/heads/develop'
113142 uses : actions/upload-artifact@v2
@@ -126,9 +155,10 @@ jobs:
126155 strategy :
127156 fail-fast : false
128157 matrix :
129- specs : ['actions_tasks', 'actions_tasks2', 'actions_tasks3', 'actions_objects', 'actions_objects2', 'actions_users', 'actions_projects_models', 'actions_organizations', ' canvas3d_functionality', 'canvas3d_functionality_2', 'issues_prs', 'issues_prs2 ']
158+ specs : ['canvas3d_functionality', 'actions ']
130159 steps :
131160 - uses : actions/checkout@v2
161+
132162 - name : Getting SHA from the default branch
133163 id : get-sha
134164 run : |
@@ -146,6 +176,7 @@ jobs:
146176
147177 echo ::set-output name=default_branch::${DEFAULT_BRANCH}
148178 echo ::set-output name=sha::${SHA}
179+
149180 - name : Waiting a cache creation in the default branch
150181 run : |
151182 URL_runs="https://api.github.com/repos/${{ github.repository }}/actions/workflows/cache.yml/runs"
@@ -179,21 +210,26 @@ jobs:
179210 echo "Number of attempts expired!"
180211 echo "Probably the creation of the cache is not yet complete. Will continue working without the cache."
181212 fi
213+
182214 - name : Getting CVAT server cache from the default branch
183215 uses : actions/cache@v2
184216 with :
185217 path : /tmp/cvat_cache_server
186218 key : ${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }}
187- - name : Getting cache CVAT UI from the default branch
219+
220+ - name : Getting CVAT UI cache from the default branch
188221 uses : actions/cache@v2
189222 with :
190223 path : /tmp/cvat_cache_ui
191224 key : ${{ runner.os }}-build-ui-${{ steps.get-sha.outputs.sha }}
225+
192226 - uses : actions/setup-node@v2
193227 with :
194228 node-version : ' 16.x'
229+
195230 - name : Set up Docker Buildx
196231 uses : docker/setup-buildx-action@v1.1.2
232+
197233 - name : Building CVAT server image
198234 uses : docker/build-push-action@v2
199235 with :
@@ -202,6 +238,7 @@ jobs:
202238 cache-from : type=local,src=/tmp/cvat_cache_server
203239 tags : openvino/cvat_server:latest
204240 load : true
241+
205242 - name : Building CVAT UI image
206243 uses : docker/build-push-action@v2
207244 with :
@@ -210,12 +247,14 @@ jobs:
210247 cache-from : type=local,src=/tmp/cvat_cache_ui
211248 tags : openvino/cvat_ui:latest
212249 load : true
250+
213251 - name : Instrumentation of the code then rebuilding the CVAT UI
214252 if : github.ref == 'refs/heads/develop'
215253 run : |
216254 npm ci
217255 npm run coverage
218256 docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml build cvat_ui
257+
219258 - name : Running e2e tests
220259 env :
221260 DJANGO_SU_NAME : ' admin'
@@ -226,38 +265,51 @@ jobs:
226265 docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml -f tests/docker-compose.file_share.yml up -d
227266 /bin/bash -c 'while [[ $(curl -s -o /dev/null -w "%{http_code}" ${API_ABOUT_PAGE}) != "401" ]]; do sleep 5; done'
228267 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"
268+
229269 cd ./tests
230270 npm ci
231- if [[ ${{ github.ref }} == 'refs/heads/develop' ]]; then
232- if [ ${{ matrix.specs }} == 'canvas3d_functionality' ] || [ ${{ matrix.specs }} == 'canvas3d_functionality_2' ]; then
233- npx cypress run --headed --browser chrome --config-file cypress_canvas3d.json --spec 'cypress/integration/${{ matrix.specs }}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
234- else
235- npx cypress run --browser chrome --spec 'cypress/integration/${{ matrix.specs }}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
236- fi
237- mv ./.nyc_output/out.json ./.nyc_output/out_${{ matrix.specs }}.json
271+
272+ if [ ${{ matrix.specs }} == 'canvas3d_functionality' ]; then
273+ # Choosing 5 test files
274+ selected_files=$(find ./cypress/integration | grep -e 'case.*\|issue.*' | grep js | grep 3d | sort | head -5 | tr '\n' ',')
275+
276+ npx cypress run \
277+ --headed \
278+ --browser chrome \
279+ --env coverage=false \
280+ --config-file cypress_canvas3d.json \
281+ --spec "${selected_files} cypress/integration/remove_users_tasks_projects_organizations.js"
238282 else
239- if [ ${{ matrix.specs }} == 'canvas3d_functionality' ] || [ ${{ matrix.specs }} == 'canvas3d_functionality_2' ]; then
240- npx cypress run --headed --browser chrome --env coverage=false --config-file cypress_canvas3d.json --spec 'cypress/integration/${{ matrix.specs }}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
241- else
242- npx cypress run --browser chrome --env coverage=false --spec 'cypress/integration/${{ matrix.specs }}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
243- fi
283+ # Choosing 20 test files
284+ find ./cypress/integration | grep -e 'case.*\|issue.*' | grep js | sed '/.*3d.*/d' | sort > test_files
285+ selected_files=$({ head -10; tail -10;} < test_files | tr '\n' ',')
286+ rm test_files
287+
288+ npx cypress run \
289+ --browser chrome \
290+ --env coverage=false \
291+ --spec "${selected_files} cypress/integration/remove_users_tasks_projects_organizations.js"
244292 fi
293+
245294 - name : Creating a log file from "cvat" container logs
246295 if : failure()
247296 run : |
248297 docker logs cvat > ${{ github.workspace }}/tests/cvat_${{ matrix.specs }}.log
298+
249299 - name : Uploading cypress screenshots as an artifact
250300 if : failure()
251301 uses : actions/upload-artifact@v2
252302 with :
253303 name : cypress_screenshots_${{ matrix.specs }}
254304 path : ${{ github.workspace }}/tests/cypress/screenshots
305+
255306 - name : Uploading "cvat" container logs as an artifact
256307 if : failure()
257308 uses : actions/upload-artifact@v2
258309 with :
259310 name : cvat_container_logs
260311 path : ${{ github.workspace }}/tests/cvat_${{ matrix.specs }}.log
312+
261313 - name : Uploading code coverage results as an artifact
262314 if : github.ref == 'refs/heads/develop'
263315 uses : actions/upload-artifact@v2
0 commit comments