Skip to content

Commit

Permalink
Move to GitHub Actions. (#2653)
Browse files Browse the repository at this point in the history
* Remove .travis.yml

* Rework env in docker-compose.ci.yml

* Add github actions configs

* Deleting unnecessary config rows.

* Apply comments. Remove unnecessary config rows.

* configured coveralls

Co-authored-by: Kruchinin <[email protected]>
Co-authored-by: Andrey Zhavoronkov <[email protected]>
  • Loading branch information
3 people authored Jan 15, 2021
1 parent c0c1bbc commit a440ef2
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 62 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI
on:
push:
branches:
- 'master'
- 'develop'
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Build CVAT
env:
HOST_COVERAGE_DATA_DIR: ${{ github.workspace }}
CONTAINER_COVERAGE_DATA_DIR: '/coverage_data'
DJANGO_SU_NAME: 'admin'
DJANGO_SU_EMAIL: '[email protected]'
DJANGO_SU_PASSWORD: '12qwaszx'
run: |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml build
docker-compose -f docker-compose.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.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'
docker-compose up -d
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"
- name: Code instrumentation
run: |
npm ci
npm run coverage
docker-compose up -d --build
- name: End-to-end testing
run: |
cd ./tests
npm ci
npx cypress run --headless --browser chrome
- name: Collect coverage data
env:
HOST_COVERAGE_DATA_DIR: ${{ github.workspace }}
CONTAINER_COVERAGE_DATA_DIR: "/coverage_data"
COVERALLS_SERVICE_NAME: github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv ./tests/.nyc_output ./
npx nyc report --reporter=text-lcov >> ${HOST_COVERAGE_DATA_DIR}/lcov.info
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd ${CONTAINER_COVERAGE_DATA_DIR} && coveralls-lcov -v -n lcov.info > ${CONTAINER_COVERAGE_DATA_DIR}/coverage.json'
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'ln -s ${CONTAINER_COVERAGE_DATA_DIR}/.git . && ln -s ${CONTAINER_COVERAGE_DATA_DIR}/.coverage . && ln -s ${CONTAINER_COVERAGE_DATA_DIR}/coverage.json . && coveralls --merge=coverage.json'
28 changes: 28 additions & 0 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI-nightly
on:
schedule:
- cron: '0 22 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Build CVAT
env:
DJANGO_SU_NAME: "admin"
DJANGO_SU_EMAIL: "[email protected]"
DJANGO_SU_PASSWORD: "12qwaszx"
API_ABOUT_PAGE: "localhost:8080/api/v1/server/about"
run: |
docker-compose -f docker-compose.yml -f ./tests/docker-compose.email.yml up -d --build
/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"
- name: End-to-end testing
run: |
cd ./tests
npm ci
npm run cypress:run:firefox
57 changes: 0 additions & 57 deletions .travis.yml

This file was deleted.

12 changes: 7 additions & 5 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ services:
- cvat_ui
- cvat_proxy
environment:
COVERALLS_REPO_TOKEN:
TRAVIS:
TRAVIS_JOB_ID:
TRAVIS_BRANCH:
TRAVIS_PULL_REQUEST:
COVERALLS_SERVICE_NAME:
CONTAINER_COVERAGE_DATA_DIR:
GITHUB_ACTIONS:
GITHUB_TOKEN:
GITHUB_WORKSPACE:
GITHUB_REF:
GITHUB_HEAD_REF:
GITHUB_RUN_ID:
volumes:
- ${HOST_COVERAGE_DATA_DIR}:${CONTAINER_COVERAGE_DATA_DIR}

0 comments on commit a440ef2

Please sign in to comment.