From 784239eaad6eba60bcc4db0f0c61a72544c2edb4 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 16:23:18 -0700 Subject: [PATCH 01/11] Workaround flaky codecov --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 81a214f43..a3d7456d5 100644 --- a/tox.ini +++ b/tox.ini @@ -71,7 +71,8 @@ basepython = python3.8 commands = python -m coverage run test.py -u coverage report -m - codecov + # codecov is flaky with no known fix, so this is a workaround + codecov --required || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) # Envs that will test installation from a wheel [testenv:wheelinstall-py35] From 55e58075844402b6e71273405ebf24238c1b89b8 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 17:10:43 -0700 Subject: [PATCH 02/11] Attempt 2 to work around flaky codecov connection --- tests/coverage/upload_codecov.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/coverage/upload_codecov.py diff --git a/tests/coverage/upload_codecov.py b/tests/coverage/upload_codecov.py new file mode 100644 index 000000000..0e88c6386 --- /dev/null +++ b/tests/coverage/upload_codecov.py @@ -0,0 +1,16 @@ +#!/bin/env/python + +from subprocess import call +import time + +if __name__ == '__main__': + max_tries = 10 + num_tries = 1 + cmd = 'codecov --required' + rc = call(cmd) + while rc != 0 and num_tries < max_tries: + time.sleep(5) + rc = call(cmd) + num_tries += 1 + + raise SystemExit(rc) From a195c7b544c1f748ec0c2b3448a36628fc927e16 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 17:11:46 -0700 Subject: [PATCH 03/11] Continue to fail silently if codecov upload fails --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index a3d7456d5..2979f73e1 100644 --- a/tox.ini +++ b/tox.ini @@ -71,8 +71,7 @@ basepython = python3.8 commands = python -m coverage run test.py -u coverage report -m - # codecov is flaky with no known fix, so this is a workaround - codecov --required || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) + - 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] From 96f85b4faec07e6e0343015517bdff4eb49db2ba Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 17:29:45 -0700 Subject: [PATCH 04/11] Fix upload script --- tests/coverage/upload_codecov.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/coverage/upload_codecov.py b/tests/coverage/upload_codecov.py index 0e88c6386..33c2529cd 100644 --- a/tests/coverage/upload_codecov.py +++ b/tests/coverage/upload_codecov.py @@ -7,10 +7,10 @@ max_tries = 10 num_tries = 1 cmd = 'codecov --required' - rc = call(cmd) + rc = call(cmd, shell=True) while rc != 0 and num_tries < max_tries: time.sleep(5) - rc = call(cmd) + rc = call(cmd, shell=True) num_tries += 1 raise SystemExit(rc) From ef16cb9c229a591e5c125697565414f8227ff8ea Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 17:45:35 -0700 Subject: [PATCH 05/11] Map codecov token in azure --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 586a0aba9..9a6fb5bd5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -116,6 +116,8 @@ jobs: tox -e $(coverageToxEnv) fi displayName: 'Run coverage tests if coverageToxEnv != ""' + env: | + CODECOV_TOKEN: $(CODECOV_TOKEN) - bash: | tox -e $(buildToxEnv) From 78c638ece60fe8d09ca225fcf1d925f08626b357 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 17:50:05 -0700 Subject: [PATCH 06/11] Try again map azure codecov token --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9a6fb5bd5..110e50033 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -117,7 +117,7 @@ jobs: fi displayName: 'Run coverage tests if coverageToxEnv != ""' env: | - CODECOV_TOKEN: $(CODECOV_TOKEN) + CODECOV_TOKEN: $(MY_CODECOV_TOKEN) - bash: | tox -e $(buildToxEnv) From af9980828d2caa57c969fc12104471201802ad4d Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 17:51:28 -0700 Subject: [PATCH 07/11] Try 3 map azure codecov token --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 110e50033..6c6385a7f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -116,7 +116,7 @@ jobs: tox -e $(coverageToxEnv) fi displayName: 'Run coverage tests if coverageToxEnv != ""' - env: | + env: CODECOV_TOKEN: $(MY_CODECOV_TOKEN) - bash: | From dd3a72db581a13c9551d10c3b2275f9ad0343fca Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 17:57:06 -0700 Subject: [PATCH 08/11] Try 4 map azure codecov token --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 2979f73e1..0a882ef1d 100644 --- a/tox.ini +++ b/tox.ini @@ -66,7 +66,7 @@ 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 From c87edb92a280d79fbee60f1b98b28273fd735183 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 18:11:22 -0700 Subject: [PATCH 09/11] Try 5 map azure codecov token --- tests/coverage/upload_codecov.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/coverage/upload_codecov.py b/tests/coverage/upload_codecov.py index 33c2529cd..fc8c68dce 100644 --- a/tests/coverage/upload_codecov.py +++ b/tests/coverage/upload_codecov.py @@ -2,6 +2,7 @@ from subprocess import call import time +import os if __name__ == '__main__': max_tries = 10 @@ -11,6 +12,7 @@ while rc != 0 and num_tries < max_tries: time.sleep(5) rc = call(cmd, shell=True) + os.remove(os.path.join(os.getcwd(), "coverage.xml")) num_tries += 1 raise SystemExit(rc) From 1f1c4f4638f2625a4049297246181b072fecda59 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 18:33:38 -0700 Subject: [PATCH 10/11] Try 6 to get azure codecov fix working --- tests/coverage/upload_codecov.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/coverage/upload_codecov.py b/tests/coverage/upload_codecov.py index fc8c68dce..b08ab4cc9 100644 --- a/tests/coverage/upload_codecov.py +++ b/tests/coverage/upload_codecov.py @@ -11,8 +11,8 @@ rc = call(cmd, shell=True) while rc != 0 and num_tries < max_tries: time.sleep(5) - rc = call(cmd, shell=True) os.remove(os.path.join(os.getcwd(), "coverage.xml")) + rc = call(cmd, shell=True) num_tries += 1 raise SystemExit(rc) From a17ce449f52f23eda19595a0bdd934afda61aae9 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 8 Jul 2020 23:20:25 -0700 Subject: [PATCH 11/11] Try 7 to get azure codecov fix working --- requirements-dev.txt | 2 +- tests/coverage/upload_codecov.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index a6f2bd74c..3e0da4794 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -codecov==2.1.3 +codecov==2.1.7 coverage==5.1 flake8==3.7.9 python-dateutil==2.8.1 diff --git a/tests/coverage/upload_codecov.py b/tests/coverage/upload_codecov.py index b08ab4cc9..9e4cdb26d 100644 --- a/tests/coverage/upload_codecov.py +++ b/tests/coverage/upload_codecov.py @@ -5,12 +5,13 @@ import os if __name__ == '__main__': - max_tries = 10 + max_tries = 3 num_tries = 1 cmd = 'codecov --required' rc = call(cmd, shell=True) while rc != 0 and num_tries < max_tries: - time.sleep(5) + 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