Prevent non-master builds, add cirrus information to upload

This commit is contained in:
Tim Wojtulewicz 2020-10-21 22:09:22 +00:00
parent e2053551cd
commit 2c9c55b058
2 changed files with 17 additions and 6 deletions

View file

@ -11,9 +11,9 @@ if [ "${CIRRUS_REPO_FULL_NAME}" != "zeek/zeek" ]; then
exit 0 exit 0
fi fi
if [ "${CIRRUS_BRANCH}" != "master" ] then if [ "${CIRRUS_BRANCH}" != "master" ]; then
echo "Coverage upload skipped for non-master branches" echo "Coverage upload skipped for non-master branches"
exit 0 exit 0
fi fi
cd testing/coverage cd testing/coverage

View file

@ -115,8 +115,8 @@ verify_run "which lcov" \
"lcov installed on system, continue" \ "lcov installed on system, continue" \
"lcov not installed, abort" "lcov not installed, abort"
# 4. Create a "tracefile" through lcov, which is necessary to create html files later on. # 4. Create a "tracefile" through lcov, which is necessary to create output later on.
echo -n "Creating tracefile for html generation... " echo -n "Creating tracefile for output generation... "
verify_run "lcov --no-external --capture --directory . --output-file $COVERAGE_FILE" verify_run "lcov --no-external --capture --directory . --output-file $COVERAGE_FILE"
# 5. Remove a number of 3rdparty and "extra" files that shoudln't be included in the # 5. Remove a number of 3rdparty and "extra" files that shoudln't be included in the
@ -132,5 +132,16 @@ if [ $HTML_REPORT -eq 1 ]; then
verify_run "genhtml -o $COVERAGE_HTML_DIR $COVERAGE_FILE" verify_run "genhtml -o $COVERAGE_HTML_DIR $COVERAGE_FILE"
else else
echo -n "Reporting to Coveralls..." echo -n "Reporting to Coveralls..."
verify_run "coveralls-lcov -t ${COVERALLS_REPO_TOKEN} ${COVERAGE_FILE}" coveralls_cmd="coveralls-lcov -t ${COVERALLS_REPO_TOKEN}"
# If we're being called by Cirrus, add some additional information to the output.
if [ -n "${CIRRUS_BUILD_ID}" ]; then
coveralls_cmd="${coveralls_cmd} --service-name=cirrus --service-job-id=${CIRRUS_BUILD_ID}"
else
coveralls_cmd="${coveralls_cmd} --service-name=local"
fi
coveralls_cmd="${coveralls_cmd} ${COVERAGE_FILE}"
verify_run "${coveralls_cmd}"
fi fi