From fb3a25ccd5175c8562718bc90754e3e09f0eaf58 Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Fri, 21 Aug 2020 07:57:14 -0400 Subject: [PATCH 01/27] Remove token restrictions (#289) * Remove token restrictions * Update version to 2.1.9 * Fix tests * force * Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ README.md | 12 +++++++----- codecov/__init__.py | 9 --------- codecov/__version__.py | 2 +- tests/test.py | 12 ------------ 5 files changed, 12 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e77e6c84..ceb3f69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### `2.1.9` + +- [#289](https://github.com/codecov/codecov-python/pull/289)Remove token restriction as it is changed server-side + ### `2.1.8` - [#285](https://github.com/codecov/codecov-python/pull/285)Add support for CODECOV_FLAGS diff --git a/README.md b/README.md index ab54a802..600b86e3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -Codecov Global Python Uploader ![PyPI](https://img.shields.io/pypi/v/codecov) [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +Codecov Global Python Uploader +[![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) +![PyPI](https://img.shields.io/pypi/v/codecov) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ======= -| [https://codecov.io/][1] | [https://community.codecov.io/][2] | [@codecov][3] | [hello@codecov.io][4] | -| ------------------------ | ---------------------------------- | ------------- | --------------------- | +| [Support][1] | [Documentation][2] | [Community Boards][3] | [Twitter][4] | +| ------------ | ------------------ | --------------------- | ------------ | Find coverage reports for all the [languages below](#languages), gather them and submit them to Codecov. @@ -100,10 +103,9 @@ If you're seeing an **HTTP 400 error when uploading reports to S3**, make sure y -[1]: https://codecov.io/ +[1]: https://codecov.io/support/ [2]: https://community.codecov.io/ [3]: https://twitter.com/codecov -[4]: mailto:hello@codecov.io ## Copyright diff --git a/codecov/__init__.py b/codecov/__init__.py index be62793d..e9645540 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -953,8 +953,6 @@ def main(*argv, **kwargs): if _slug: query["slug"] = _slug.groups()[1] - assert query.get("job") or query.get("token"), "Missing repository upload token" - # Processing gcov # --------------- if "gcov" in codecov.disable: @@ -1189,13 +1187,6 @@ def main(*argv, **kwargs): "Tip: See all example repositories: https://github.com/codecov?query=example" ) - write("Support channels:", "green") - write( - " Email: hello@codecov.io\n" - " IRC: #codecov\n" - " Gitter: https://gitter.im/codecov/support\n" - " Twitter: @codecov\n" - ) sys.exit(1 if codecov.required else 0) else: diff --git a/codecov/__version__.py b/codecov/__version__.py index 8e0b8295..26010cbb 100644 --- a/codecov/__version__.py +++ b/codecov/__version__.py @@ -5,4 +5,4 @@ __license__ = "Apache 2.0" __title__ = "codecov" __url__ = "https://github.com/codecov/codecov-python" -__version__ = "2.1.8" +__version__ = "2.1.9" diff --git a/tests/test.py b/tests/test.py index de4af8e8..39ca23a9 100644 --- a/tests/test.py +++ b/tests/test.py @@ -294,18 +294,6 @@ def test_send_error(self): else: raise Exception("400 never raised") - @data((dict(commit="sha"), "Missing repository upload token"),) - def test_require_branch(self, dd): - (kwargs, reason) = dd - # this is so we dont get branch for local git - self.set_env(JENKINS_URL="hello") - try: - self.run_cli(**kwargs) - except AssertionError as e: - self.assertEqual(str(e), reason) - else: - raise Exception("Did not raise AssertionError") - @unittest.skipIf( os.getenv("CI") == "True" and os.getenv("APPVEYOR") == "True", "Skip AppVeyor CI test", From ff88f77bdccc08fd584f5423acdbb076ee8b3cf0 Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Wed, 26 Aug 2020 09:40:40 -0400 Subject: [PATCH 02/27] Update python versions (#291) * Update python versions * Add 3.8 on GHA --- .github/workflows/build-test.yml | 2 +- .travis.yml | 4 ++-- setup.py | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 05b442a9..7d826ac4 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7] + python-version: [3.5, 3.6, 3.7, 3.8] steps: - uses: actions/checkout@v2 diff --git a/.travis.yml b/.travis.yml index 2e6150f9..238470ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,10 @@ sudo: false python: - 2.7 - pypy - - 3.4 - 3.5 - 3.6 - 3.7 + - 3.8 - pypy3 matrix: include: @@ -24,7 +24,7 @@ matrix: - python-requests - python-coverage - python-mock - - python: 3.7 + - python: 3.8 dist: xenial script: make format diff --git a/setup.py b/setup.py index 4d418234..6deb6ae6 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,7 @@ "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: PyPy", "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Testing", From 14753520f744971720da9d8d10c8bf2f631a7608 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2020 09:59:24 -0400 Subject: [PATCH 03/27] Bump coverage from 4.5.4 to 5.2.1 (#290) Bumps [coverage](https://github.com/nedbat/coveragepy) from 4.5.4 to 5.2.1. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-4.5.4...coverage-5.2.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index b6f891ef..c7ff8052 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,4 @@ -coverage==4.5.4 +coverage==5.2.1 ddt mock pytest>=4.6.0 From 6795ee05baa53172eb1c00b1e945fffa1d20e26e Mon Sep 17 00:00:00 2001 From: fossabot Date: Wed, 26 Aug 2020 17:44:13 -0500 Subject: [PATCH 04/27] Add license scan report and status (#292) Signed off by: fossabot --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 600b86e3..28d3b0f3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Codecov Global Python Uploader [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) ![PyPI](https://img.shields.io/pypi/v/codecov) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python?ref=badge_shield) ======= | [Support][1] | [Documentation][2] | [Community Boards][3] | [Twitter][4] | | ------------ | ------------------ | --------------------- | ------------ | @@ -110,3 +111,7 @@ If you're seeing an **HTTP 400 error when uploading reports to S3**, make sure y ## Copyright > Copyright 2014-2020 codecov + + +## License +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python?ref=badge_large) \ No newline at end of file From bf97a8bd807cd7839476f63b79b5ae22ae075d5e Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Mon, 31 Aug 2020 11:41:56 -0400 Subject: [PATCH 05/27] Update README with accurate links (#294) * Update README with accurate links * force * format * format * last format --- Makefile | 2 +- README.md | 10 ++++++---- tests/test.py | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 7eae04f4..fae2de1e 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ test: py.test tests/test.py --cov=codecov format: - black . --check + black . -v -t py38 --check --diff compare: hub compare $(shell git tag --sort=refname | tail -1)...master diff --git a/README.md b/README.md index 28d3b0f3..d3a4a306 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -Codecov Global Python Uploader +# Codecov Global Python Uploader + [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) ![PyPI](https://img.shields.io/pypi/v/codecov) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) @@ -105,8 +106,9 @@ If you're seeing an **HTTP 400 error when uploading reports to S3**, make sure y [1]: https://codecov.io/support/ -[2]: https://community.codecov.io/ -[3]: https://twitter.com/codecov +[2]: https://docs.codecov.io/ +[3]: https://community.codecov.io/ +[4]: https://twitter.com/codecov ## Copyright @@ -114,4 +116,4 @@ If you're seeing an **HTTP 400 error when uploading reports to S3**, make sure y ## License -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python?ref=badge_large) \ No newline at end of file +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-python?ref=badge_large) diff --git a/tests/test.py b/tests/test.py index 39ca23a9..d17a0f77 100644 --- a/tests/test.py +++ b/tests/test.py @@ -278,7 +278,7 @@ def test_send(self): gzip_worker.decompress(put.call_args[1]["data"]) + gzip_worker.flush() ) - assert u"tests/test.py".encode("utf-8") in reports + assert "tests/test.py".encode("utf-8") in reports def test_send_error(self): with patch("requests.post") as post: @@ -866,7 +866,9 @@ def test_ci_gitlab(self): ) def test_ci_github(self): self.set_env( - HOME="/", CODECOV_TOKEN="token", CODECOV_NAME="name", + HOME="/", + CODECOV_TOKEN="token", + CODECOV_NAME="name", ) self.fake_report() res = self.run_cli() From 663888151217ff585b206ff721a61c429070a4ad Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Wed, 9 Sep 2020 22:58:13 +0200 Subject: [PATCH 06/27] Improve error reporting in the "try_run" function and correctly include original command output in the error message (#153) * Log more info when a command fails. * Also log return code. * Correctly include process output with the thrown exception. * Include returncode before the output. * Update codecov/__init__.py * black Co-authored-by: Thomas Hu Co-authored-by: Thomas Hu --- codecov/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index e9645540..d3cc9d4f 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -213,7 +213,7 @@ def check_output(cmd, **popen_args): process = Popen(cmd, stdout=PIPE, **popen_args) output, _ = process.communicate() if process.returncode: - raise CalledProcessError(process.returncode, cmd) + raise CalledProcessError(process.returncode, cmd, output) else: assert process.returncode == 0 return output.decode("utf-8") @@ -223,7 +223,10 @@ def try_to_run(cmd, shell=False, cwd=None): try: return check_output(cmd, shell=shell, cwd=cwd) except Exception as e: - write(" Error running `%s`: %s" % (cmd, e or str(e))) + write( + " Error running `%s`: returncode=%s, output=%s" + % (cmd, e.returncode, str(getattr(e, "output", str(e)))) + ) return None From 0c56f298e88e609370b05ae2aa8d77e150518745 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 14 Sep 2020 09:13:24 -0400 Subject: [PATCH 07/27] Bump coverage from 5.2.1 to 5.3 (#296) Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.2.1 to 5.3. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.2.1...coverage-5.3) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index c7ff8052..0d22b4bd 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,4 @@ -coverage==5.2.1 +coverage==5.3 ddt mock pytest>=4.6.0 From 2574d1b7c327d71df447551395e374441c38775f Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Mon, 14 Sep 2020 14:45:46 -0700 Subject: [PATCH 08/27] Added sleep between upload retries. (#295) * Added sleep 2s between upload retries. * Set default retries to 5 same as bash uploader. * Log retry attempts. --- codecov/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index d3cc9d4f..3d6f4fc5 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -290,11 +290,14 @@ def generate_toc(root): return str(res).strip() or "" -def retry_upload(url, request_method, retries=3, break_codes=(200,), **kwargs): - for _ in range(retries): +def retry_upload(url, request_method, retries=5, break_codes=(200,), **kwargs): + wait_seconds = 2 + for i in range(retries): res = request_method(url, **kwargs) if res.status_code in break_codes: return res + write(" Retrying {0}/{1} in {2}s..".format(i + 1, retries, wait_seconds)) + sleep(wait_seconds) return res @@ -412,7 +415,7 @@ def main(*argv, **kwargs): advanced.add_argument("--tag", default=None, help="Git tag") advanced.add_argument( "--tries", - default=3, + default=5, type=int, help="Specify the total number of attempts to make when uploading coverage report", ) From 9137404b785122973abce66515c58d8999d0dbce Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 15 Sep 2020 17:06:07 +0200 Subject: [PATCH 09/27] Output elapsed time with S3 upload (#148) * Output elapsed time with S3 upload It seems that it fails with "Forbidden" when it takes longer than 15s, so this at least helps with debugging that. The Bash uploader gzips the data file, so it is faster to upload and does not trigger it with the given data file / internet connection. (Pdb++) s3.text '\nAccessDeniedRequest has expired2018-05-19T11:58:04Z2018-05-19T11:58:10ZEFE63A2DA8CE9726LXoeTEXV7h3wN5DICvZg/U6uWIeyOgkJ1JnyEOQCpKNkQtpst4qKhkxuTgPnJeV3uB1jOexYP+s=' * black Co-authored-by: Thomas Hu --- codecov/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/codecov/__init__.py b/codecov/__init__.py index 3d6f4fc5..fd6ac89b 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -1149,6 +1149,7 @@ def main(*argv, **kwargs): ) s3.raise_for_status() assert s3.status_code == 200 + write(" Uploading to S3 took %s" % s3.elapsed) write(" " + result) success = True From dd8fe1a4b69ec71feb28553e74f93abe152703a8 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Tue, 15 Sep 2020 18:54:18 -0400 Subject: [PATCH 10/27] Ignore emacs lisp files (#297) Tahoe-LAFS project has a file named `/misc/coding_tools/coverage.el`, which is often uploaded to codecov along with the regular coverage report. I'm not sure it is doing any harm, but can't be doing anything useful either! It would be nice if codecov could ignore `.el` files. --- codecov/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/codecov/__init__.py b/codecov/__init__.py index fd6ac89b..370c03ff 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -88,6 +88,7 @@ def sanitize_arg(replacement, arg): r"(/\.coverage.*)|" r"(\.coveragerc)|" r"(\.egg)|" + r"(\.el)|" r"(\.gif)|" r"(\.ini)|" r"(\.less)|" From 713d94113e9b1189f227adc6131f04c65e4f967b Mon Sep 17 00:00:00 2001 From: Pierre Augier Date: Mon, 21 Sep 2020 21:20:12 +0200 Subject: [PATCH 11/27] Fix error try_to_run using | without shell=True (#298) --- codecov/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 370c03ff..e337717e 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -869,7 +869,7 @@ def main(*argv, **kwargs): try: query["commit"] = try_to_run( ["git", "rev-parse", "HEAD"] - ) or try_to_run(["hg", "id", "-i", "--debug", "|", "tr", "-d", "'+'"]) + ) or try_to_run(["hg", "log", "-r", ".", "-T", "{node}"]) write(" -> Got sha from git/hg") except: # pragma: no cover From 76b4f7cbb5602332eac3bcae027b9fa24efbf4ac Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Fri, 9 Oct 2020 08:32:28 -0400 Subject: [PATCH 12/27] Bump to 2.1.10 (#300) --- CHANGELOG.md | 16 ++++++++++++++++ codecov/__version__.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceb3f69e..c70fc15a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +### `2.1.10` + +#### Fixes +- [#148](https://github.com/codecov/codecov-python/pull/148) Output elapsed time with S3 upload +- [#153](https://github.com/codecov/codecov-python/pull/153) Improve error reporting in the "try_run" function and correctly include original command output in the error message +- [#295](https://github.com/codecov/codecov-python/pull/295) Added sleep between upload retries. +- [#297](https://github.com/codecov/codecov-python/pull/297) Ignore emacs lisp files +- [#298](https://github.com/codecov/codecov-python/pull/298) Fix error try_to_run using | without shell=True (fix #284) + +#### Dependencies and Misc +- [#290](https://github.com/codecov/codecov-python/pull/290) Bump coverage from 4.5.4 to 5.2.1 +- [#291](https://github.com/codecov/codecov-python/pull/291) Update python versions +- [#292](https://github.com/codecov/codecov-python/pull/292) Add license scan report and status +- [#294](https://github.com/codecov/codecov-python/pull/294) Update README with accurate links +- [#296](https://github.com/codecov/codecov-python/pull/296) Bump coverage from 5.2.1 to 5.3 + ### `2.1.9` - [#289](https://github.com/codecov/codecov-python/pull/289)Remove token restriction as it is changed server-side diff --git a/codecov/__version__.py b/codecov/__version__.py index 26010cbb..0e467e9f 100644 --- a/codecov/__version__.py +++ b/codecov/__version__.py @@ -5,4 +5,4 @@ __license__ = "Apache 2.0" __title__ = "codecov" __url__ = "https://github.com/codecov/codecov-python" -__version__ = "2.1.9" +__version__ = "2.1.10" From 5862842228187f4ed919bf8f9c1ac3692d1ccbbc Mon Sep 17 00:00:00 2001 From: Gaurav Sheni Date: Fri, 16 Oct 2020 10:07:28 -0400 Subject: [PATCH 13/27] Update to Python 3.9 (#301) * Update .travis.yml * Update setup.py * Update build-test.yml * Update .travis.yml Co-authored-by: Tom Hu --- .github/workflows/build-test.yml | 2 +- .travis.yml | 1 + setup.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7d826ac4..b07bc8fb 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 diff --git a/.travis.yml b/.travis.yml index 238470ee..f69f56d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ python: - 3.6 - 3.7 - 3.8 + - 3.9-dev - pypy3 matrix: include: diff --git a/setup.py b/setup.py index 6deb6ae6..b5639c73 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: PyPy", "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Testing", From 58032a4960cf1fb62ebaa88297440e92726ea2ac Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Wed, 9 Dec 2020 18:35:44 -0800 Subject: [PATCH 14/27] Added option to disable printing of gcov-out (#305) --- codecov/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index e337717e..2b338d8b 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -376,6 +376,9 @@ def main(*argv, **kwargs): gcov.add_argument( "--gcov-exec", default="gcov", help="gcov executable to run. Defaults to 'gcov'" ) + gcov.add_argument( + "--no-gcov-out", action="store_true", default=False, help="Disable gcov output" + ) gcov.add_argument("--gcov-args", default="", help="extra arguments to pass to gcov") advanced = parser.add_argument_group( @@ -982,8 +985,11 @@ def main(*argv, **kwargs): if codecov.gcov_args: cmd.append(sanitize_arg("", codecov.gcov_args or "")) cmd.append(path) - write(" Executing gcov (%s)" % cmd) - write(try_to_run(cmd)) + if not codecov.no_gcov_out: + write(" Executing gcov (%s)" % cmd) + gcov_out = try_to_run(cmd) + if not codecov.no_gcov_out: + write(gcov_out) # Collect Reports # --------------- From f4b116df8fac14dd98c52acf2a1ca0ac8d54db68 Mon Sep 17 00:00:00 2001 From: Udi Meiri Date: Sat, 12 Dec 2020 14:29:56 -0800 Subject: [PATCH 15/27] Handle exceptions that don't have a returncode (#308) Fixes #307 --- codecov/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 2b338d8b..9490dd40 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -226,7 +226,11 @@ def try_to_run(cmd, shell=False, cwd=None): except Exception as e: write( " Error running `%s`: returncode=%s, output=%s" - % (cmd, e.returncode, str(getattr(e, "output", str(e)))) + % ( + cmd, + str(getattr(e, "returncode", None)), + str(getattr(e, "output", str(e))), + ) ) return None From a8f6ff27feb6600731a3efef6cff9d54469efa30 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 17 Dec 2020 10:48:10 -0500 Subject: [PATCH 16/27] Bump to 2.1.11 (#310) --- CHANGELOG.md | 11 ++++++++++- codecov/__version__.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c70fc15a..21256923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### `2.1.11` + +#### Fixes +- #305 Added option to disable printing of gcov-out +- #308 Handle exceptions that don't have a returncode + +#### Dependencies and Misc +- #301 Update to Python 3.9 + ### `2.1.10` #### Fixes @@ -10,7 +19,7 @@ #### Dependencies and Misc - [#290](https://github.com/codecov/codecov-python/pull/290) Bump coverage from 4.5.4 to 5.2.1 - [#291](https://github.com/codecov/codecov-python/pull/291) Update python versions -- [#292](https://github.com/codecov/codecov-python/pull/292) Add license scan report and status +- [#292](https://github.com/codecov/codecov-python/pull/292) Add license scan report and status - [#294](https://github.com/codecov/codecov-python/pull/294) Update README with accurate links - [#296](https://github.com/codecov/codecov-python/pull/296) Bump coverage from 5.2.1 to 5.3 diff --git a/codecov/__version__.py b/codecov/__version__.py index 0e467e9f..bc5c0a72 100644 --- a/codecov/__version__.py +++ b/codecov/__version__.py @@ -5,4 +5,4 @@ __license__ = "Apache 2.0" __title__ = "codecov" __url__ = "https://github.com/codecov/codecov-python" -__version__ = "2.1.10" +__version__ = "2.1.11" From 147802d7403db0c21b81820ba9a8619b8d398b2b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 21 Jan 2021 13:07:57 -0500 Subject: [PATCH 17/27] Bump coverage from 5.3 to 5.3.1 (#311) Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.3 to 5.3.1. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.3...coverage-5.3.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 0d22b4bd..55995759 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,4 @@ -coverage==5.3 +coverage==5.3.1 ddt mock pytest>=4.6.0 From 26fe18b0e7019e3415f1df525fbe4dfb72057714 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 12 Feb 2021 09:33:38 -0500 Subject: [PATCH 18/27] Bump coverage from 5.3.1 to 5.4 (#312) Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.3.1 to 5.4. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.3.1...coverage-5.4) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 55995759..577a93c5 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,4 @@ -coverage==5.3.1 +coverage==5.4 ddt mock pytest>=4.6.0 From 158a38eed7fd6f0d2f9c9f4c5258ab1f244b6e13 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 5 Mar 2021 09:28:36 -0500 Subject: [PATCH 19/27] Bump coverage from 5.4 to 5.5 (#314) Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.4 to 5.5. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/coverage-5.4...coverage-5.5) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 577a93c5..7dbe1dda 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,4 @@ -coverage==5.4 +coverage==5.5 ddt mock pytest>=4.6.0 From 51469b065f0e16d4bedf121552b5e1eb58e18125 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 1 May 2021 17:46:24 -0400 Subject: [PATCH 20/27] Upgrade to GitHub-native Dependabot (#320) Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..491deae0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: pip + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 From 27a9833441ab179118716b86026e526919b2a0db Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Tue, 6 Jul 2021 21:39:09 +0100 Subject: [PATCH 21/27] Add Cirrus CI (#322) * Add Cirrus CI This is a follow up of the discussion in: https://community.codecov.com/t/add-support-of-uploading-from-cirrus-ci-without-token/1028/34 and uses the bash uploader as a reference: https://github.com/codecov/codecov-bash/blob/master/codecov#L959 * Add test case for Cirrus CI --- README.md | 3 ++- codecov/__init__.py | 21 ++++++++++++++++++++- tests/test.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d3a4a306..6a061739 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ after_success: ## CI Providers -| Company | Supported | Token Required | +| Company | Supported | Token Required | | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | | [AppVeyor](https://www.appveyor.com/) | Yes [![Build status](https://ci.appveyor.com/api/projects/status/sw18lsj7786bw806/branch/master?svg=true)](https://ci.appveyor.com/project/stevepeak/codecov-python/branch/master) | Private only | | [Bamboo](https://www.atlassian.com/software/bamboo) | `coming soon` | | @@ -96,6 +96,7 @@ after_success: | [Solano Labs](https://www.solanolabs.com/) | `coming soon` | | | [Travis CI](https://travis-ci.org/) | Yes [![Build Status](https://secure.travis-ci.org/codecov/codecov-python.svg?branch=master)](https://travis-ci.org/codecov/codecov-python) | Private only | | [Wercker](http://wercker.com/) | Yes | Public & Private | +| [Cirrus CI](https://cirrus-ci.org/) | Yes | Private only | | Git / Mercurial | Yes (as a fallback) | Public & Private | diff --git a/codecov/__init__.py b/codecov/__init__.py index 9490dd40..99109edf 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -329,7 +329,7 @@ def main(*argv, **kwargs): "--token", "-t", default=os.getenv("CODECOV_TOKEN"), - help="Private repository token or @filename for file containing the token. Defaults to $CODECOV_TOKEN. Not required for public repositories on Travis CI, CircleCI and AppVeyor", + help="Private repository token or @filename for file containing the token. Defaults to $CODECOV_TOKEN. Not required for public repositories on Travis CI, CircleCI, AppVeyor and CirrusCI", ) basics.add_argument( "--file", @@ -845,6 +845,25 @@ def main(*argv, **kwargs): write(" GitHub Actions CI Detected") + # --------- + # Cirrus CI + # --------- + elif os.getenv("CIRRUS_CI"): + # https://cirrus-ci.org/guide/writing-tasks/#environment-variables + query.update( + dict( + service="cirrus-ci", + slug=os.getenv("CIRRUS_REPO_FULL_NAME"), + branch=os.getenv("CIRRUS_BRANCH"), + pr=os.getenv("CIRRUS_PR"), + commit=os.getenv("CIRRUS_CHANGE_IN_REPO"), + build=os.getenv("CIRRUS_BUILD_ID"), + build_url="https://cirrus-ci.com/task/" + os.getenv("CIRRUS_TASK_ID"), + job=os.getenv("CIRRUS_TASK_NAME"), + ) + ) + write(" Cirrus CI Detected") + else: query.update( dict( diff --git a/tests/test.py b/tests/test.py index d17a0f77..98a4412a 100644 --- a/tests/test.py +++ b/tests/test.py @@ -879,6 +879,37 @@ def test_ci_github(self): self.assertEqual(res["codecov"].token, "token") self.assertEqual(res["codecov"].name, "name") + @unittest.skipUnless( + os.getenv("CI") == "true" and os.getenv("CIRRUS_CI") == "true", + "Skip Cirrus CI", + ) + def test_ci_cirrus(self): + # The data used in this test follows the test case data in + # https://github.com/codecov/codecov-bash/pull/127 + # Discussion about using codecov without token for Cirrus CI can be seen in: + # https://community.codecov.com/t/add-support-of-uploading-from-cirrus-ci-without-token/1028/36 + self.set_env( + HOME="/", + CIRRUS_CI="true", + CIRRUS_REPO_FULL_NAME="codecov/ci-repo", + CIRRUS_BRANCH="master", + CIRRUS_PR="1", + CIRRUS_CHANGE_IN_REPO="180c0d097354fc1a451da8a3be5aba255f2ffd9f", + CIRRUS_BUILD_ID="777", + CIRRUS_TASK_ID="239", + CIRRUS_TASK_NAME="test" + ) + self.fake_report() + res = self.run_cli() + self.assertEqual(res["query"]["service"], "cirrus-ci") + self.assertEqual(res["query"]["slug"], "codecov/ci-repo") + self.assertEqual(res["query"]["branch"], "master") + self.assertEqual(res["query"]["pr"], "1") + self.assertEqual(res["query"]["commit"], os.getenv("CIRRUS_CHANGE_IN_REPO")) + self.assertEqual(res["query"]["build"], "777") + self.assertEqual(res["query"]["build_url"], "https://cirrus-ci.com/task/239") + self.assertEqual(res["query"]["job"], "test") + @unittest.skip("Skip CI None") def test_ci_none(self): self.set_env(CODECOV_TOKEN="token", CODECOV_NAME="name") From fcff43933beb9f242e6ef0eb4c70670f4543e289 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Mon, 2 Aug 2021 13:55:46 -0400 Subject: [PATCH 22/27] chore: bump to 2.1.12 (#323) --- CHANGELOG.md | 11 +++++++++++ codecov/__version__.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21256923..d5eb65e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +### `2.1.12` + +#### Fixes +- #322 Add Cirrus CI + +#### Dependencies and Misc +- #311 Bump coverage from 5.3 to 5.3.1 +- #312 Bump coverage from 5.3.1 to 5.4 +- #314 Bump coverage from 5.4 to 5.5 +- #320 Upgrade to GitHub-native Dependabot + ### `2.1.11` #### Fixes diff --git a/codecov/__version__.py b/codecov/__version__.py index bc5c0a72..c79ac593 100644 --- a/codecov/__version__.py +++ b/codecov/__version__.py @@ -5,4 +5,4 @@ __license__ = "Apache 2.0" __title__ = "codecov" __url__ = "https://github.com/codecov/codecov-python" -__version__ = "2.1.11" +__version__ = "2.1.12" From 46e1b8c69923a8c6a94c8de4ec1c950c7c6cc1e8 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Thu, 2 Sep 2021 17:23:17 -0400 Subject: [PATCH 23/27] Add deprecation notice (#325) * Add deprecation notice * Add link to uploader source --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 6a061739..a617c4fc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +🚨🚨 Deprecation Notice 🚨🚨 + +This uploader is being deprecated by the Codecov team. We recommend migrating to our [new uploader](https://docs.codecov.com/docs/codecov-uploader) as soon as possible to prevent any lapses in coverage. [The new uploader is open source](https://github.com/codecov/uploader), and we highly encourage submitting Issues and Pull Requests. + +You can visit our blog post to learn more about our [deprecation plan](https://about.codecov.io/blog/codecov-uploader-deprecation-plan/) + +**On February 1, 2022 this uploader will be completely deprecated and will no longer be able to upload coverage to Codecov.** + # Codecov Global Python Uploader [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) From 12c0dddd6350a1d511f22d363e89d9019b149164 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Tue, 5 Oct 2021 08:46:50 -0400 Subject: [PATCH 24/27] Add migration guide link (#327) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a617c4fc..f6fef3ad 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This uploader is being deprecated by the Codecov team. We recommend migrating to our [new uploader](https://docs.codecov.com/docs/codecov-uploader) as soon as possible to prevent any lapses in coverage. [The new uploader is open source](https://github.com/codecov/uploader), and we highly encourage submitting Issues and Pull Requests. -You can visit our blog post to learn more about our [deprecation plan](https://about.codecov.io/blog/codecov-uploader-deprecation-plan/) +You can visit our [migration guide](https://docs.codecov.com/docs/deprecated-uploader-migration-guide#python-uploader) for help moving to our new uploader, and our blog post to learn more about our [deprecation plan](https://about.codecov.io/blog/codecov-uploader-deprecation-plan/) **On February 1, 2022 this uploader will be completely deprecated and will no longer be able to upload coverage to Codecov.** From 37663707961db1092134500fe19638a5c08c52c2 Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Fri, 23 Sep 2022 00:01:37 -0400 Subject: [PATCH 25/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6fef3ad..27531afd 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ If you're seeing an **HTTP 400 error when uploading reports to S3**, make sure y ## Copyright -> Copyright 2014-2020 codecov +> Copyright 2014-2022 codecov ## License From a78512e4b00e67cfb3fccb530c9ca97a6c42eae5 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 17 Apr 2023 16:09:07 -0700 Subject: [PATCH 26/27] chore(release): bump to 3.1.13 --- codecov/__version__.py | 2 +- setup.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/codecov/__version__.py b/codecov/__version__.py index c79ac593..60d08bb3 100644 --- a/codecov/__version__.py +++ b/codecov/__version__.py @@ -5,4 +5,4 @@ __license__ = "Apache 2.0" __title__ = "codecov" __url__ = "https://github.com/codecov/codecov-python" -__version__ = "2.1.12" +__version__ = "2.1.13" diff --git a/setup.py b/setup.py index b5639c73..1025c49b 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,13 @@ from codecs import open import os from setuptools import setup +from setuptools.command.install import install + +class PostInstallCommand(install): + def run(self): + install.run(self) + print("\n**** The codecov package has been deprecated and will be removed by the team in the future. Please update to use the uploader (https://docs.codecov.com/docs/codecov-uploader) to prevent any breakages in workflow. ****\n") + classifiers = [ "Development Status :: 5 - Production/Stable", @@ -45,4 +52,7 @@ install_requires=["requests>=2.7.9", "coverage"], entry_points={"console_scripts": ["codecov=codecov:main"]}, python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + cmdclass={ + 'install': PostInstallCommand, + }, ) From e553e93ed1404095acaf9a8bc3ef239675d3b88e Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Tue, 18 Apr 2023 14:38:11 -0700 Subject: [PATCH 27/27] chore(ci): bump python and update packages (#351) --- .github/workflows/build-test.yml | 6 ++--- .travis.yml | 40 -------------------------------- 2 files changed, 3 insertions(+), 43 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index b07bc8fb..154d8a07 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -15,14 +15,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f69f56d8..00000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: python -# cache: pip -notifications: - email: false -dist: xenial -sudo: false -python: - - 2.7 - - pypy - - 3.5 - - 3.6 - - 3.7 - - 3.8 - - 3.9-dev - - pypy3 -matrix: - include: - - python: 2.7 - dist: trusty - virtualenv: - system_site_packages: true - addons: - apt: - packages: - - python-requests - - python-coverage - - python-mock - - python: 3.8 - dist: xenial - script: make format - -install: - - pip install -r tests/requirements.txt - - python setup.py install -script: - - make reinstall - - make test - # - pytest tests/test.py --cov=codecov -after_success: - - codecov