Skip to content

Commit

Permalink
Merge pull request #8 from mastacheata/coverage-diff-fallback
Browse files Browse the repository at this point in the history
Fallback for Coverage Diff
  • Loading branch information
GitRon authored Oct 4, 2023
2 parents 8131b5f + 46cc8c1 commit 31845c2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ambient_toolbox/gitlab/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def get_coverage_from_pipeline(self, pipeline_id: int, job_name: str) -> (float,
print(f'Pipeline-URL: {pipeline["web_url"]}')

if job_name == '':
return coverages_total, coverages_total
print(
'\033[91mATTN: No CI_COVERAGE_JOB_NAME provided, using Total Coverage and skipping Coverage Diff\033[0m'
)
return coverages_total, coverages_total, None

coverage_job = coverages.get(job_name)

Expand Down Expand Up @@ -224,7 +227,12 @@ def process(self):
self.current_pipeline_id, self.job_name
)

self.print_diff(target_job_log, current_job_log)
if target_job_log is None or current_job_log is None:
print('\n\n\033[91m***************************************************************************\033[0m')
print(' \033[91m**/!\\** Coverage log not found. Skipping diff. **/!\\**\033[0m ')
print('\033[91m***************************************************************************\033[0m\n\n')
else:
self.print_diff(target_job_log, current_job_log)

# numeric value of the coverage diff sign
sign_job_coverage = (current_job_coverage > target_job_coverage) - (current_job_coverage < target_job_coverage)
Expand Down

0 comments on commit 31845c2

Please sign in to comment.