diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 0000000000..88e1986ed9 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,2 @@ +service_name: travis-pro +repo_token: hnXUEBKsORKHc8xIENGs9JjktlTb2HKlG diff --git a/.travis.yml b/.travis.yml index e027319a59..c14f80e015 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ before_install: - nvm install 0.10 install: + - pip install coveralls - tools/travis/setup-$TEST_SUITE - tools/clean-venv-cache --travis cache: @@ -9,10 +10,15 @@ cache: - $HOME/phantomjs - $HOME/zulip-venv-cache env: - - TEST_SUITE=frontend - - TEST_SUITE=backend - - TEST_SUITE=production - - TEST_SUITE=py3k + global: + - COVERALLS_PARALLEL=true + - COVERALLS_SERVICE_NAME=travis-pro + - COVERALLS_REPO_TOKEN=hnXUEBKsORKHc8xIENGs9JjktlTb2HKlG + matrix: + - TEST_SUITE=frontend + - TEST_SUITE=backend + - TEST_SUITE=production + - TEST_SUITE=py3k language: python python: - "2.7" @@ -28,3 +34,7 @@ services: - docker addons: postgresql: "9.3" +after_success: + coveralls +notifications: + webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN diff --git a/tools/run-mypy b/tools/run-mypy index 3deee6d72c..ff22e26798 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -36,8 +36,8 @@ parser.add_argument('-m', '--modified', action='store_true', default=False, help parser.add_argument('-a', '--all', dest='all', action='store_true', default=False, help="""run mypy on all python files, ignoring the exclude list. This is useful if you have to find out which files fail mypy check.""") -parser.add_argument('--linecount-report', dest='linecount_report', action='store_true', default=False, - help="""run the linecount report to see annotation coverage""") +parser.add_argument('--linecoverage-report', dest='linecoverage_report', action='store_true', default=False, + help="""run the linecoverage report to see annotation coverage""") parser.add_argument('--disallow-untyped-defs', dest='disallow_untyped_defs', action='store_true', default=False, help="""throw errors when functions are not annotated""") args = parser.parse_args() @@ -58,9 +58,9 @@ else: mypy_command = "mypy" extra_args = ["--fast-parser", "--silent-imports", "--py2", "--check-untyped-defs"] -if args.linecount_report: - extra_args.append("--linecount-report") - extra_args.append("linecount-report") +if args.linecoverage_report: + extra_args.append("--linecoverage-report") + extra_args.append("linecoverage-report") if args.disallow_untyped_defs: extra_args.append("--disallow-untyped-defs") @@ -68,6 +68,13 @@ if args.disallow_untyped_defs: # run mypy if python_files: rc = subprocess.call([mypy_command] + extra_args + python_files) + if args.linecoverage_report: + # Move the coverage report to where coveralls will look for it. + try: + os.rename('linecoverage-report/coverage.txt', '.coverage') + except OSError: + # maybe mypy crashed; exit with its error code + pass sys.exit(rc) else: print("There are no files to run mypy on.") diff --git a/tools/setup/py3_test_reqs.txt b/tools/setup/py3_test_reqs.txt index 257e606d3b..004b5d66ac 100644 --- a/tools/setup/py3_test_reqs.txt +++ b/tools/setup/py3_test_reqs.txt @@ -1,3 +1,3 @@ six==1.10.0 -git+https://github.com/python/mypy.git@e1c5a255877cf817eda525466b0d33f8bc4e50b3 +git+https://github.com/rwbarton/mypy.git@3f4497689636cc9eea44239ba3ab73f1f5c7aaa6 typed-ast==0.5.2 diff --git a/tools/travis/mypy b/tools/travis/mypy index c2d8c0c1e8..e4ab8e8078 100755 --- a/tools/travis/mypy +++ b/tools/travis/mypy @@ -1,7 +1,7 @@ #!/bin/bash -echo '+ ./tools/run-mypy' -./tools/run-mypy +echo '+ ./tools/run-mypy --linecoverage-report' +./tools/run-mypy --linecoverage-report retcode="$?" if [ "$retcode" == "0" ]; then