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

Add support for running in gitlab CI #161

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 7 additions & 2 deletions cpp_coveralls/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# THIS FILE HAS BEEN MODIFIED BY D7919
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to remove.

from __future__ import absolute_import
from __future__ import print_function

Expand Down Expand Up @@ -73,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.environ.get('COVERALLS_SERVICE_NAME',
'travis-ci'))

if not args.gcov_options:
args.gcov_options = yml.get('gcov_options', '')
Expand All @@ -86,7 +89,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"
Expand Down
5 changes: 4 additions & 1 deletion cpp_coveralls/gitrepo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# THIS FILE HAS BEEN MODIFIED BY D7919
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to remove.


from __future__ import absolute_import

import os
Expand Down Expand Up @@ -43,7 +45,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]
}
Expand Down