From b3876d990ad3c6519d1c73325269ed1dec73a0f5 Mon Sep 17 00:00:00 2001 From: David Dickinson Date: Thu, 10 Dec 2020 10:26:43 +0000 Subject: [PATCH 1/6] Attempt to fetch branch from gitlab environment --- cpp_coveralls/gitrepo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp_coveralls/gitrepo.py b/cpp_coveralls/gitrepo.py index b7e09e2..5d52d9a 100644 --- a/cpp_coveralls/gitrepo.py +++ b/cpp_coveralls/gitrepo.py @@ -43,7 +43,8 @@ def gitrepo(cwd): }, 'branch': os.environ.get('TRAVIS_BRANCH', os.environ.get('APPVEYOR_REPO_BRANCH', - repo.git('rev-parse', '--abbrev-ref', 'HEAD')[1].strip())), + os.environ.get('CI_COMMIT_BRANCH', + repo.git('rev-parse', '--abbrev-ref', 'HEAD')[1].strip()))), 'remotes': [{'name': line.split()[0], 'url': line.split()[1]} for line in repo.git('remote', '-v')[1] if '(fetch)' in line] } From 2963de42d1bd64b0db97d2ce12128e3533f0c373 Mon Sep 17 00:00:00 2001 From: David Dickinson Date: Thu, 10 Dec 2020 10:59:10 +0000 Subject: [PATCH 2/6] Ensure modified file flagged --- cpp_coveralls/gitrepo.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp_coveralls/gitrepo.py b/cpp_coveralls/gitrepo.py index 5d52d9a..b431070 100644 --- a/cpp_coveralls/gitrepo.py +++ b/cpp_coveralls/gitrepo.py @@ -1,3 +1,5 @@ +# THIS FILE HAS BEEN MODIFIED BY D7919 + from __future__ import absolute_import import os From 66741d3204a2acb459608557531989c60124ce86 Mon Sep 17 00:00:00 2001 From: David Dickinson Date: Thu, 10 Dec 2020 10:59:30 +0000 Subject: [PATCH 3/6] Try to get pipeline id for gitlab --- cpp_coveralls/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpp_coveralls/__init__.py b/cpp_coveralls/__init__.py index c3d0e4e..0dcc734 100644 --- a/cpp_coveralls/__init__.py +++ b/cpp_coveralls/__init__.py @@ -1,3 +1,4 @@ +# THIS FILE HAS BEEN MODIFIED BY D7919 from __future__ import absolute_import from __future__ import print_function @@ -86,7 +87,9 @@ def run(): args.include.extend(yml.get('include', [])) args.exclude_lines_pattern.extend(yml.get('exclude_lines_pattern', [])) - args.service_job_id = os.environ.get('TRAVIS_JOB_ID', '') + args.service_job_id = os.environ.get('TRAVIS_JOB_ID', + os.environ.get('CI_PIPELINE_ID', + '')) if args.repo_token == '' and args.service_job_id == '': raise ValueError("\nno coveralls.io token specified and no travis job id found\n" From 5791257c13e085115136e4ff1a51f1dc12934460 Mon Sep 17 00:00:00 2001 From: David Dickinson Date: Thu, 10 Dec 2020 10:59:48 +0000 Subject: [PATCH 4/6] Add COVERALLS_SERVICE_NAME to make it easier to set service name without yaml --- README.md | 1 + cpp_coveralls/__init__.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 689f1bd..cdcb27c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Inspired from [z4r/python-coveralls](https://github.com/z4r/python-coveralls), i - `COVERALLS_REPO_TOKEN` - `COVERALLS_ENDPOINT` - `COVERALLS_PARALLEL` +- `COVERALLS_SERVICE_NAME` ## Usage: diff --git a/cpp_coveralls/__init__.py b/cpp_coveralls/__init__.py index 0dcc734..372c134 100644 --- a/cpp_coveralls/__init__.py +++ b/cpp_coveralls/__init__.py @@ -74,7 +74,9 @@ def run(): # use environment COVERALLS_REPO_TOKEN as a fallback args.repo_token = os.environ.get('COVERALLS_REPO_TOKEN') - args.service_name = yml.get('service_name', 'travis-ci') + args.service_name = yml.get('service_name', + os.get.environ('COVERALLS_SERVICE_NAME', + 'travis-ci') if not args.gcov_options: args.gcov_options = yml.get('gcov_options', '') From 1cdf6f5442842f37c033acf1a7400aa7cc459ae3 Mon Sep 17 00:00:00 2001 From: David Dickinson Date: Thu, 10 Dec 2020 11:11:24 +0000 Subject: [PATCH 5/6] Add missing bracket --- cpp_coveralls/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp_coveralls/__init__.py b/cpp_coveralls/__init__.py index 372c134..4dd428a 100644 --- a/cpp_coveralls/__init__.py +++ b/cpp_coveralls/__init__.py @@ -76,7 +76,7 @@ def run(): args.service_name = yml.get('service_name', os.get.environ('COVERALLS_SERVICE_NAME', - 'travis-ci') + 'travis-ci')) if not args.gcov_options: args.gcov_options = yml.get('gcov_options', '') From 7f88de77cd8d0537e9345d050bbd0a27f9403cd5 Mon Sep 17 00:00:00 2001 From: David Dickinson Date: Thu, 10 Dec 2020 11:26:54 +0000 Subject: [PATCH 6/6] Correct order typo --- cpp_coveralls/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp_coveralls/__init__.py b/cpp_coveralls/__init__.py index 4dd428a..f62ebf1 100644 --- a/cpp_coveralls/__init__.py +++ b/cpp_coveralls/__init__.py @@ -75,7 +75,7 @@ def run(): args.repo_token = os.environ.get('COVERALLS_REPO_TOKEN') args.service_name = yml.get('service_name', - os.get.environ('COVERALLS_SERVICE_NAME', + os.environ.get('COVERALLS_SERVICE_NAME', 'travis-ci')) if not args.gcov_options: