@ -16,9 +16,11 @@ jobs:
runs-on : ubuntu-latest
runs-on : ubuntu-latest
steps:
steps:
- uses : actions/checkout@v2
- uses : actions/checkout@v2
- uses : actions/setup-python@v2
- uses : actions/setup-python@v2
with:
with:
python-version : '3.8'
python-version : '3.8'
- name : Getting SHA from the default branch
- name : Getting SHA from the default branch
id : get-sha
id : get-sha
run : |
run : |
@ -36,6 +38,7 @@ jobs:
echo ::set-output name=default_branch::${DEFAULT_BRANCH}
echo ::set-output name=default_branch::${DEFAULT_BRANCH}
echo ::set-output name=sha::${SHA}
echo ::set-output name=sha::${SHA}
- name : Waiting a cache creation in the default branch
- name : Waiting a cache creation in the default branch
if : ${{ github.ref_name != 'develop' }}
if : ${{ github.ref_name != 'develop' }}
run : |
run : |
@ -69,13 +72,22 @@ jobs:
echo "Number of attempts expired!"
echo "Number of attempts expired!"
echo "Probably the creation of the cache is not yet complete. Will continue working without the cache."
echo "Probably the creation of the cache is not yet complete. Will continue working without the cache."
fi
fi
- name : Getting CVAT server cache from the default branch
- name : Getting CVAT server cache from the default branch
uses : actions/cache@v2
uses : actions/cache@v2
with:
with:
path : /tmp/cvat_cache_server
path : /tmp/cvat_cache_server
key : ${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }}
key : ${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }}
- name : Getting CVAT UI cache from the default branch
uses : actions/cache@v2
with:
path : /tmp/cvat_cache_ui
key : ${{ runner.os }}-build-ui-${{ steps.get-sha.outputs.sha }}
- name : Set up Docker Buildx
- name : Set up Docker Buildx
uses : docker/setup-buildx-action@v1.1.2
uses : docker/setup-buildx-action@v1.1.2
- name : Building CVAT server image
- name : Building CVAT server image
uses : docker/build-push-action@v2
uses : docker/build-push-action@v2
with:
with:
@ -84,11 +96,22 @@ jobs:
cache-from : type=local,src=/tmp/cvat_cache_server
cache-from : type=local,src=/tmp/cvat_cache_server
tags : openvino/cvat_server:latest
tags : openvino/cvat_server:latest
load : true
load : true
- name : Building CVAT UI image
uses : docker/build-push-action@v2
with:
context : .
file : ./Dockerfile.ui
cache-from : type=local,src=/tmp/cvat_cache_ui
tags : openvino/cvat_ui:latest
load : true
- name : Running OPA tests
- name : Running OPA tests
run : |
run : |
curl -L -o opa https://openpolicyagent.org/downloads/v0.34.2/opa_linux_amd64_static
curl -L -o opa https://openpolicyagent.org/downloads/v0.34.2/opa_linux_amd64_static
chmod +x ./opa
chmod +x ./opa
./opa test cvat/apps/iam/rules
./opa test cvat/apps/iam/rules
- name : Running REST API tests
- name : Running REST API tests
env:
env:
API_ABOUT_PAGE : "localhost:8080/api/server/about"
API_ABOUT_PAGE : "localhost:8080/api/server/about"
@ -98,16 +121,22 @@ jobs:
run : |
run : |
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
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
/bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${API_ABOUT_PAGE})" != "401" ]]; do sleep 5; done'
/bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${API_ABOUT_PAGE})" != "401" ]]; do sleep 5; done'
pip3 install --user -r tests/rest_api/requirements.txt
pip3 install --user -r tests/rest_api/requirements.txt
pytest tests/rest_api/
pytest tests/rest_api/ -k 'GET'
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
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
- name : Running unit tests
- name : Running unit tests
env:
env:
HOST_COVERAGE_DATA_DIR : ${{ github.workspace }}
HOST_COVERAGE_DATA_DIR : ${{ github.workspace }}
CONTAINER_COVERAGE_DATA_DIR : "/coverage_data"
CONTAINER_COVERAGE_DATA_DIR : "/coverage_data"
run : |
run : |
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}'
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash \
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'
-c 'coverage run -a manage.py test cvat/apps utils/cli -k 'tasks_id' -k 'lambda' -k 'share' && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}'
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'
- name : Uploading code coverage results as an artifact
- name : Uploading code coverage results as an artifact
if : github.ref == 'refs/heads/develop'
if : github.ref == 'refs/heads/develop'
uses : actions/upload-artifact@v2
uses : actions/upload-artifact@v2
@ -126,9 +155,10 @@ jobs:
strategy:
strategy:
fail-fast : false
fail-fast : false
matrix:
matrix:
specs : [ ' actions_tasks', 'actions_tasks2' , 'actions_tasks3' , 'actions_objects' , 'actions_objects2' , 'actions_users' , 'actions_projects_models' , 'actions_organizations' , ' canvas3d_functionality', ' c anvas3d_fun ctionality_2', 'i ssues_prs', 'issues_prs2 ']
specs : [ ' canvas3d_functionality', ' actions']
steps:
steps:
- uses : actions/checkout@v2
- uses : actions/checkout@v2
- name : Getting SHA from the default branch
- name : Getting SHA from the default branch
id : get-sha
id : get-sha
run : |
run : |
@ -146,6 +176,7 @@ jobs:
echo ::set-output name=default_branch::${DEFAULT_BRANCH}
echo ::set-output name=default_branch::${DEFAULT_BRANCH}
echo ::set-output name=sha::${SHA}
echo ::set-output name=sha::${SHA}
- name : Waiting a cache creation in the default branch
- name : Waiting a cache creation in the default branch
run : |
run : |
URL_runs="https://api.github.com/repos/${{ github.repository }}/actions/workflows/cache.yml/runs"
URL_runs="https://api.github.com/repos/${{ github.repository }}/actions/workflows/cache.yml/runs"
@ -179,21 +210,26 @@ jobs:
echo "Number of attempts expired!"
echo "Number of attempts expired!"
echo "Probably the creation of the cache is not yet complete. Will continue working without the cache."
echo "Probably the creation of the cache is not yet complete. Will continue working without the cache."
fi
fi
- name : Getting CVAT server cache from the default branch
- name : Getting CVAT server cache from the default branch
uses : actions/cache@v2
uses : actions/cache@v2
with:
with:
path : /tmp/cvat_cache_server
path : /tmp/cvat_cache_server
key : ${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }}
key : ${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }}
- name : Getting cache CVAT UI from the default branch
- name : Getting CVAT UI cache from the default branch
uses : actions/cache@v2
uses : actions/cache@v2
with:
with:
path : /tmp/cvat_cache_ui
path : /tmp/cvat_cache_ui
key : ${{ runner.os }}-build-ui-${{ steps.get-sha.outputs.sha }}
key : ${{ runner.os }}-build-ui-${{ steps.get-sha.outputs.sha }}
- uses : actions/setup-node@v2
- uses : actions/setup-node@v2
with:
with:
node-version : '16.x'
node-version : '16.x'
- name : Set up Docker Buildx
- name : Set up Docker Buildx
uses : docker/setup-buildx-action@v1.1.2
uses : docker/setup-buildx-action@v1.1.2
- name : Building CVAT server image
- name : Building CVAT server image
uses : docker/build-push-action@v2
uses : docker/build-push-action@v2
with:
with:
@ -202,6 +238,7 @@ jobs:
cache-from : type=local,src=/tmp/cvat_cache_server
cache-from : type=local,src=/tmp/cvat_cache_server
tags : openvino/cvat_server:latest
tags : openvino/cvat_server:latest
load : true
load : true
- name : Building CVAT UI image
- name : Building CVAT UI image
uses : docker/build-push-action@v2
uses : docker/build-push-action@v2
with:
with:
@ -210,12 +247,14 @@ jobs:
cache-from : type=local,src=/tmp/cvat_cache_ui
cache-from : type=local,src=/tmp/cvat_cache_ui
tags : openvino/cvat_ui:latest
tags : openvino/cvat_ui:latest
load : true
load : true
- name : Instrumentation of the code then rebuilding the CVAT UI
- name : Instrumentation of the code then rebuilding the CVAT UI
if : github.ref == 'refs/heads/develop'
if : github.ref == 'refs/heads/develop'
run : |
run : |
npm ci
npm ci
npm run coverage
npm run coverage
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml build cvat_ui
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml build cvat_ui
- name : Running e2e tests
- name : Running e2e tests
env:
env:
DJANGO_SU_NAME : 'admin'
DJANGO_SU_NAME : 'admin'
@ -226,38 +265,51 @@ jobs:
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
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
/bin/bash -c 'while [[ $(curl -s -o /dev/null -w "%{http_code}" ${API_ABOUT_PAGE}) != "401" ]]; do sleep 5; done'
/bin/bash -c 'while [[ $(curl -s -o /dev/null -w "%{http_code}" ${API_ABOUT_PAGE}) != "401" ]]; do sleep 5; done'
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"
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"
cd ./tests
cd ./tests
npm ci
npm ci
if [[ ${{ github.ref }} == 'refs/heads/develop' ]]; then
if [ ${{ matrix.specs }} == 'canvas3d_functionality' ] || [ ${{ matrix.specs }} == 'canvas3d_functionality_2' ]; then
if [ ${{ matrix.specs }} == 'canvas3d_functionality' ]; then
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'
# Choosing 5 test files
else
selected_files=$(find ./cypress/integration | grep -e 'case.*\|issue.*' | grep js | grep 3d | sort | head -5 | tr '\n' ',')
npx cypress run --browser chrome --spec 'cypress/integration/${{ matrix.specs }}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
fi
npx cypress run \
mv ./.nyc_output/out.json ./.nyc_output/out_${{ matrix.specs }}.json
--headed \
--browser chrome \
--env coverage=false \
--config-file cypress_canvas3d.json \
--spec "${selected_files} cypress/integration/remove_users_tasks_projects_organizations.js"
else
else
if [ ${{ matrix.specs }} == 'canvas3d_functionality' ] || [ ${{ matrix.specs }} == 'canvas3d_functionality_2' ]; then
# Choosing 20 test files
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'
find ./cypress/integration | grep -e 'case.*\|issue.*' | grep js | sed '/.*3d.*/d' | sort > test_files
else
selected_files=$({ head -10; tail -10;} < test_files | tr '\n' ',')
npx cypress run --browser chrome --env coverage=false --spec 'cypress/integration/${{ matrix.specs }}/**/*.js,cypress/integration/remove_users_tasks_projects_organizations.js'
rm test_files
fi
npx cypress run \
--browser chrome \
--env coverage=false \
--spec "${selected_files} cypress/integration/remove_users_tasks_projects_organizations.js"
fi
fi
- name : Creating a log file from "cvat" container logs
- name : Creating a log file from "cvat" container logs
if : failure()
if : failure()
run : |
run : |
docker logs cvat > ${{ github.workspace }}/tests/cvat_${{ matrix.specs }}.log
docker logs cvat > ${{ github.workspace }}/tests/cvat_${{ matrix.specs }}.log
- name : Uploading cypress screenshots as an artifact
- name : Uploading cypress screenshots as an artifact
if : failure()
if : failure()
uses : actions/upload-artifact@v2
uses : actions/upload-artifact@v2
with:
with:
name : cypress_screenshots_${{ matrix.specs }}
name : cypress_screenshots_${{ matrix.specs }}
path : ${{ github.workspace }}/tests/cypress/screenshots
path : ${{ github.workspace }}/tests/cypress/screenshots
- name : Uploading "cvat" container logs as an artifact
- name : Uploading "cvat" container logs as an artifact
if : failure()
if : failure()
uses : actions/upload-artifact@v2
uses : actions/upload-artifact@v2
with:
with:
name : cvat_container_logs
name : cvat_container_logs
path : ${{ github.workspace }}/tests/cvat_${{ matrix.specs }}.log
path : ${{ github.workspace }}/tests/cvat_${{ matrix.specs }}.log
- name : Uploading code coverage results as an artifact
- name : Uploading code coverage results as an artifact
if : github.ref == 'refs/heads/develop'
if : github.ref == 'refs/heads/develop'
uses : actions/upload-artifact@v2
uses : actions/upload-artifact@v2