Skip to content

Commit

Permalink
Fix coverage measurement (#1516)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max authored May 13, 2020
1 parent 5ab5499 commit 214eead
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
branch = true
# relative_files = true # does not work?

source =
datumaro/datumaro/
Expand Down Expand Up @@ -36,4 +37,4 @@ exclude_lines =
# don't fail on the code that can be found
ignore_errors = true

skip_empty = true
skip_empty = true
16 changes: 5 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,17 @@ services:

env:
- CONTAINER_COVERAGE_DATA_DIR="/coverage_data"
HOST_COVERAGE_DATA_DIR="${TRAVIS_BUILD_DIR}/coverage_data"

install:
- gem install coveralls-lcov
- pip install coveralls
HOST_COVERAGE_DATA_DIR="${TRAVIS_BUILD_DIR}"

before_script:
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml build
- mkdir -m a=rwx -p ${HOST_COVERAGE_DATA_DIR}
- chmod a+rwx ${HOST_COVERAGE_DATA_DIR}

script:
# FIXME: Git package and application name conflict in PATH
# FIXME: Git package and application name conflict in PATH and try to leave only one python test execution
- 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 && coverage run -a manage.py test --pattern="_test*.py" cvat/apps/dataset_manager/tests cvat/apps/engine/tests utils/cli && coverage run -a manage.py test datumaro/ && 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 install && cd ../cvat-core && npm install && npm run test && mv ./reports/coverage/lcov.info ${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 install && cd ../cvat-core && npm install && npm run test && coveralls-lcov -v -n ./reports/coverage/lcov.info > ${CONTAINER_COVERAGE_DATA_DIR}/coverage.json'

after_success:
# https://coveralls-python.readthedocs.io/en/latest/usage/multilang.html
- mv ${HOST_COVERAGE_DATA_DIR}/* .
- coveralls-lcov -v -n lcov.info > coverage.json
- coveralls --merge=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'
10 changes: 8 additions & 2 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &
build-essential \
google-chrome-stable \
nodejs \
python3-dev && \
python3-dev \
ruby \
&& \
rm -rf /var/lib/apt/lists/*;

RUN python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt
RUN python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt && \
python3 -m pip install --no-cache-dir coveralls
RUN gem install coveralls-lcov

COPY .coveragerc .

# RUN all commands below as 'django' user
USER ${USER}
Expand Down

0 comments on commit 214eead

Please sign in to comment.