Enhance Codecov integration (#1136)

* Define sub-projects and set coverage threshold for failure in the `codecov.yml`; make both test execution engines to generate also JUnit reports; upload these JUnit reports to Codecov for analysis

* Fix UI Vite config and add more details to the API is-generated-code script

* Add API JUnit report file to `.gitignore`

* Fix the copy issue by mounting the volume

* put the exact report name to the `docker cp` command

* Added `set -euxo pipeline` to the `test_api_coverage.sh` script; try to fix the missing report issue by setting immutable flag and report directoty

* Revert `chattr` and `set` commands, as they cause errors

* debug

* put the filename of the JUnit report to upload

* `set -euxo pipefail` in `scripts/test_api_coverage.sh`

---------

Co-authored-by: Konstantin Koval
This commit is contained in:
Kostiantyn
2024-11-25 16:25:38 +02:00
committed by GitHub
parent f1b523a27e
commit 6c020cc1f9
8 changed files with 51 additions and 8 deletions

View File

@@ -1,10 +1,10 @@
#!/bin/sh
set -eu
for test in $(dirname $0)/test_*
do
if [ "${test}" != "${test%%/scripts/test_all.sh}" ]
then
go install github.com/jstemmer/go-junit-report@latest
for test in $(dirname $0)/test_*; do
if [ "${test}" != "${test%%/scripts/test_all.sh}" ]; then
continue
fi

View File

@@ -1,5 +1,5 @@
#!/bin/sh
set -eu
#!/bin/bash
set -euxo pipefail
cd $(dirname $0)/../api
go test ./... -v -database -filesystem -p 1 -coverprofile=coverage.txt -covermode=atomic
go test ./... -v -database -filesystem -p 1 -coverprofile=coverage.txt -covermode=atomic 2>&1 | tee >(go-junit-report >test-api-coverage-report.xml)

View File

@@ -5,6 +5,8 @@ cd $(dirname $0)/../api
go generate ./...
if [ "$(git status -s 2>/dev/null | head -1)" != "" ]; then
echo '--- FAIL: The generated API code is out of sync with the recent changes. Please run `go generate ./...` under `./api` to regenerate it and commit it to this branch.'
echo 'These are the changes:'
git status -s
exit 1
fi