-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add coverage figures collector
Signed-off-by: Thomas Fossati <thomas.fossati@linaro.org>
- Loading branch information
1 parent
7cb0f9e
commit 9fdd031
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import re | ||
import sys | ||
|
||
# read output of (potentially many invocations of) "go test -cover -short", | ||
# e.g., "coverage: 65.7% of statements" | ||
cover_report_lines = sys.stdin.read() | ||
|
||
if len(cover_report_lines) == 0: | ||
sys.exit(2) | ||
|
||
# extract min coverage from GITHUB_WORKFLOW, e.g., "60.4%" | ||
min_cover = float(re.findall(r'\d*\.\d+|\d+', os.environ['GITHUB_WORKFLOW'])[0]) | ||
|
||
for l in cover_report_lines.splitlines(): | ||
cover = float(re.findall(r'\d*\.\d+|\d+', l)[0]) | ||
if cover < min_cover: | ||
sys.exit(1) | ||
|
||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
type go-licenses &> /dev/null || go get github.com/google/go-licenses | ||
|
||
MODULES+=("github.com/veraison/corim/cocli") | ||
|
||
for module in ${MODULES[@]} | ||
do | ||
echo ">> retrieving licenses [ ${module} ]" | ||
go-licenses csv ${module} | ||
done |