Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around codecov.io connection failures #396

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ jobs:
tox -e $(coverageToxEnv)
fi
displayName: 'Run coverage tests if coverageToxEnv != ""'
env:
CODECOV_TOKEN: $(MY_CODECOV_TOKEN)

- bash: |
tox -e $(buildToxEnv)
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
codecov==2.1.3
codecov==2.1.7
coverage==5.1
flake8==3.7.9
python-dateutil==2.8.1
Expand Down
19 changes: 19 additions & 0 deletions tests/coverage/upload_codecov.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/env/python

from subprocess import call
import time
import os

if __name__ == '__main__':
max_tries = 3
num_tries = 1
cmd = 'codecov --required'
rc = call(cmd, shell=True)
while rc != 0 and num_tries < max_tries:
print("Try #%d/%d failed. Sleeping for 60 seconds and trying again..." % (num_tries, max_tries))
time.sleep(60)
os.remove(os.path.join(os.getcwd(), "coverage.xml"))
rc = call(cmd, shell=True)
num_tries += 1

raise SystemExit(rc)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ commands = {[testenv:build]commands}

# Envs that will only be executed on CI that does coverage reporting
[testenv:coverage]
passenv = CI CIRCLECI CIRCLE_*
passenv = CI CIRCLECI CIRCLE_* CODECOV_TOKEN
basepython = python3.8
commands =
python -m coverage run test.py -u
coverage report -m
codecov
- python tests/coverage/upload_codecov.py # do not report error if codecov upload fails

# Envs that will test installation from a wheel
[testenv:wheelinstall-py35]
Expand Down