status-go/_assets/scripts/codecov.sh

30 lines
895 B
Bash
Raw Permalink Normal View History

2024-09-05 17:39:56 +00:00
#!/usr/bin/env bash
source "${GIT_ROOT}/_assets/scripts/colors.sh"
report_to_codecov() {
# https://go.dev/blog/integration-test-coverage
2024-09-05 17:39:56 +00:00
echo -e "${GRN}Uploading coverage report to Codecov${RST}"
local tests_report_wildcard="${1}"
local coverage_report="${2}"
local test_type="${3}"
# Gather report files with given wildcard
local report_files_args=""
for file in ${tests_report_wildcard}; do
report_files_args+="--file ${file} "
done
codecov do-upload --token "${CODECOV_TOKEN}" --report-type test_results ${report_files_args}
codecov upload-process --token "${CODECOV_TOKEN}" -f ${coverage_report} -F "${test_type}"
}
2024-09-13 16:21:58 +00:00
convert_coverage_to_html() {
echo -e "${GRN}Generating HTML coverage report${RST}"
local input_coverage_report="${1}"
local output_coverage_report="${2}"
go tool cover -html "${input_coverage_report}" -o "${output_coverage_report}"
}