mirror of https://github.com/zulip/zulip.git
ci: Don't remove .coverage file & set empty suffix.
Fixes #14962 * codecov needs `.coverage` file in the pwd to upload coverage results. * concurrency='multiprocessing' forces `.coverage` file to have a data_suffix, we explicity set it to "" for the file to have no suffix. Filed issue as https://github.com/nedbat/coveragepy/issues/989
This commit is contained in:
parent
12fd515831
commit
c9bff71410
|
@ -95,11 +95,20 @@ aliases:
|
||||||
run:
|
run:
|
||||||
name: upload coverage report
|
name: upload coverage report
|
||||||
command: |
|
command: |
|
||||||
|
# codecov requires `.coverage` file to be stored in pwd for
|
||||||
|
# uploading coverage results.
|
||||||
|
mv /home/circleci/zulip/var/.coverage /home/circleci/zulip/.coverage
|
||||||
|
|
||||||
. /srv/zulip-py3-venv/bin/activate
|
. /srv/zulip-py3-venv/bin/activate
|
||||||
# codecov version is fixed here, since future versions of it
|
# TODO: Check that the next release of codecov doesn't
|
||||||
# use "find" for locating files which is buggy on some platforms.
|
# throw find error.
|
||||||
# See https://github.com/codecov/codecov-python/issues/250
|
# codecov==2.0.16 introduced a bug which uses "find"
|
||||||
pip install codecov==2.0.15 && codecov \
|
# for locating files which is buggy on some platforms.
|
||||||
|
# It was fixed via https://github.com/codecov/codecov-python/pull/217
|
||||||
|
# and should get automatically fixed here once it's released.
|
||||||
|
# We cannot pin the version here because we need the latest version for uploading files.
|
||||||
|
# see https://community.codecov.io/t/http-400-while-uploading-to-s3-with-python-codecov-from-travis/1428/7
|
||||||
|
pip install codecov && codecov \
|
||||||
|| echo "Error in uploading coverage reports to codecov.io."
|
|| echo "Error in uploading coverage reports to codecov.io."
|
||||||
|
|
||||||
- &build_production
|
- &build_production
|
||||||
|
|
|
@ -12,7 +12,7 @@ set -x
|
||||||
# docker setup means the auto-detection logic sees the ~36 processes
|
# docker setup means the auto-detection logic sees the ~36 processes
|
||||||
# the Docker host has, not the ~2 processes of resources we're
|
# the Docker host has, not the ~2 processes of resources we're
|
||||||
# allocated.
|
# allocated.
|
||||||
./tools/test-backend --coverage --include-webhooks --parallel=6
|
./tools/test-backend --coverage --include-webhooks --no-cov-cleanup --parallel=6
|
||||||
|
|
||||||
# We run mypy after the backend tests so we get output from the
|
# We run mypy after the backend tests so we get output from the
|
||||||
# backend tests, which tend to uncover more serious problems, first.
|
# backend tests, which tend to uncover more serious problems, first.
|
||||||
|
|
|
@ -216,6 +216,10 @@ def main() -> None:
|
||||||
parser.add_argument('--verbose-coverage', dest='verbose_coverage',
|
parser.add_argument('--verbose-coverage', dest='verbose_coverage',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False, help='Enable verbose print of coverage report.')
|
default=False, help='Enable verbose print of coverage report.')
|
||||||
|
parser.add_argument('--no-cov-cleanup', dest='no_cov_cleanup',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help="Do not clean generated coverage files.")
|
||||||
|
|
||||||
parser.add_argument('--parallel', dest='processes',
|
parser.add_argument('--parallel', dest='processes',
|
||||||
type=int,
|
type=int,
|
||||||
|
@ -354,10 +358,12 @@ def main() -> None:
|
||||||
assert_provisioning_status_ok(options.force)
|
assert_provisioning_status_ok(options.force)
|
||||||
|
|
||||||
if options.coverage:
|
if options.coverage:
|
||||||
import atexit
|
|
||||||
import coverage
|
import coverage
|
||||||
cov = coverage.Coverage(config_file="tools/coveragerc", concurrency='multiprocessing')
|
cov = coverage.Coverage(data_suffix="", config_file="tools/coveragerc", concurrency='multiprocessing')
|
||||||
atexit.register(lambda: cov.erase()) # Ensure the data file gets cleaned up at the end.
|
# Do not clean .coverage file in CircleCi job so that coverage data can be uploaded.
|
||||||
|
if not options.no_cov_cleanup:
|
||||||
|
import atexit
|
||||||
|
atexit.register(lambda: cov.erase()) # Ensure the data file gets cleaned up at the end.
|
||||||
cov.start()
|
cov.start()
|
||||||
if options.profile:
|
if options.profile:
|
||||||
import cProfile
|
import cProfile
|
||||||
|
@ -407,7 +413,6 @@ def main() -> None:
|
||||||
cov.stop()
|
cov.stop()
|
||||||
cov.save()
|
cov.save()
|
||||||
cov.combine()
|
cov.combine()
|
||||||
cov.data_suffix = False # Disable suffix so that filename is .coverage
|
|
||||||
cov.save()
|
cov.save()
|
||||||
if options.verbose_coverage:
|
if options.verbose_coverage:
|
||||||
print("Printing coverage data")
|
print("Printing coverage data")
|
||||||
|
|
Loading…
Reference in New Issue