diff --git a/Makefile b/Makefile index 144a7f1dd..0a4454a42 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/_assets/scripts/codecov.sh b/_assets/scripts/codecov.sh index 217e85a0f..69b0c6d57 100755 --- a/_assets/scripts/codecov.sh +++ b/_assets/scripts/codecov.sh @@ -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}" +} \ No newline at end of file diff --git a/_assets/scripts/run_integration_tests.sh b/_assets/scripts/run_integration_tests.sh index 113caed42..855c92af4 100755 --- a/_assets/scripts/run_integration_tests.sh +++ b/_assets/scripts/run_integration_tests.sh @@ -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 diff --git a/_assets/scripts/run_unit_tests.sh b/_assets/scripts/run_unit_tests.sh index 416cbdae0..b8b4e0fc6 100755 --- a/_assets/scripts/run_unit_tests.sh +++ b/_assets/scripts/run_unit_tests.sh @@ -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 diff --git a/integration-tests/docker-compose.anvil.yml b/integration-tests/docker-compose.anvil.yml index 61dc6a158..0fc8d26c6 100644 --- a/integration-tests/docker-compose.anvil.yml +++ b/integration-tests/docker-compose.anvil.yml @@ -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