chore_: minor improvements

This commit is contained in:
Igor Sirotin 2024-09-13 17:21:58 +01:00
parent 9cd2d33117
commit 3a992f2515
No known key found for this signature in database
GPG Key ID: 425E227CAAB81F95
5 changed files with 18 additions and 9 deletions

View File

@ -488,7 +488,6 @@ test-verif-proxy-wrapper:
CGO_CFLAGS="$(CGO_CFLAGS)" go test -v github.com/status-im/status-go/rpc -tags gowaku_skip_migrations,nimbus_light_client -run ^TestProxySuite$$ -testify.m TestRun -ldflags $(LDFLAGS)
#run-integration-tests: SHELL := /bin/sh # Run in nix-shell, we need codecov
run-integration-tests: export INTEGRATION_TESTS_DOCKER_UID ?= $(call sh, id -u)
run-integration-tests: export INTEGRATION_TESTS_REPORT_CODECOV ?= false
run-integration-tests:

View File

@ -19,3 +19,12 @@ report_to_codecov() {
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}"
}
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}"
}

View File

@ -17,10 +17,12 @@ test_results_path="${root_path}/reports"
# Cleanup any previous coverage reports
rm -rf "${coverage_reports_path}"
rm -rf "${test_results_path}"
# Create directories
mkdir -p "${binary_coverage_reports_path}"
mkdir -p "${merged_coverage_reports_path}"
mkdir -p "${test_results_path}"
all_compose_files="-f ${root_path}/docker-compose.anvil.yml -f ${root_path}/docker-compose.test.status-go.yml"
@ -41,15 +43,12 @@ exit_code=$(docker inspect integration-tests_tests-rpc_1 -f '{{.State.ExitCode}}
echo -e "${GRN}Stopping docker containers${RST}"
docker-compose ${all_compose_files} down
# Prepare coverage reports
echo -e "${GRN}Gathering code coverage reports${RST}"
# Collect coverage reports
echo -e "${GRN}Collecting code coverage reports${RST}"
full_coverage_profile="${coverage_reports_path}/coverage.out"
# Merge coverage reports
go tool covdata merge -i="${binary_coverage_reports_path}" -o="${merged_coverage_reports_path}"
# Convert coverage reports to profile
go tool covdata textfmt -i="${merged_coverage_reports_path}" -o="${full_coverage_profile}"
convert_coverage_to_html "${full_coverage_profile}" "${coverage_reports_path}/coverage.html"
# Upload reports to Codecov
if [[ ${INTEGRATION_TESTS_REPORT_CODECOV} == 'true' ]]; then

View File

@ -149,8 +149,7 @@ echo -e "${GRN}Filtering test coverage packages:${RST} ./cmd"
grep -v '^github.com/status-im/status-go/cmd/' ${merged_coverage_report} > ${final_coverage_report}
# Generate HTML coverage report
echo -e "${GRN}Generating HTML coverage report${RST}"
go tool cover -html ${final_coverage_report} -o test-coverage.html
convert_coverage_to_html ${final_coverage_report} "test-coverage.html"
# Upload coverage report to CodeClimate
if [[ $UNIT_TEST_REPORT_CODECLIMATE == 'true' ]]; then

View File

@ -1,11 +1,13 @@
services:
anvil:
user: ${INTEGRATION_TESTS_DOCKER_UID}
image: ghcr.io/foundry-rs/foundry:latest
platform: linux/amd64
command:
- anvil --host 0.0.0.0
deploy-sntv2:
user: ${INTEGRATION_TESTS_DOCKER_UID}
platform: linux/amd64
environment:
- API_KEY_ETHERSCAN="" # API_KEY env var is required, but value isn't used
@ -23,6 +25,7 @@ services:
--private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
deploy-communities-contracts:
user: ${INTEGRATION_TESTS_DOCKER_UID}
platform: linux/amd64
environment:
# API_KEY_* env vars are required, but values aren't used