From c0b26d5b694bee993a9fc285d34e6f3fb0f45e45 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 15 Jun 2022 11:23:43 -0500 Subject: [PATCH] improve sonarcloud coverage testing behavior The sonarcloud job was accidentally altered to use *only* the PLG coverage data, which is incomplete for reasons not yet fully understood. Unfortunately, it wasn't *waiting* for the PLG coverage data to be complete -- the job could start before the PLG coverage ran, which mean that you could get anywhere from a few percent to nearly total code coverage. Also, we want to be sure to cover *both* the PLG and non-PLG coverage data, so we add the non-PLG coverage data. We also factor out the simulacraData package from our PKG_LIST because it appears to be confusing sonarcloud because that package isn't "included in project" or something. Also remove a stray `ls` that was probably part of the original testing/debugging of this. --- .gitlab/.gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml index b6e1fba77..8cb6af4b3 100644 --- a/.gitlab/.gitlab-ci.yml +++ b/.gitlab/.gitlab-ci.yml @@ -129,7 +129,7 @@ run go tests future: retry: 1 script: - echo "Running featurebase unit tests..." - - PKG_LIST=$(go list ./... | grep -v internal/clustertests | paste -s -d, -) + - PKG_LIST=$(go list ./... | grep -Ev 'internal/clustertests|simulacraData' | paste -s -d, -) - go test -timeout=30m -json -coverprofile=coverage.out -covermode=atomic -coverpkg=${PKG_LIST} ./... | tee test-report.out artifacts: paths: @@ -146,7 +146,7 @@ run go tests future plg: retry: 1 script: - echo "Running featurebase plg-specific unit tests..." - - PKG_LIST=$(go list ./... | grep -v internal/clustertests | paste -s -d, -) + - PKG_LIST=$(go list ./... | grep -Ev 'internal/clustertests|simulacraData' | paste -s -d, -) - go test -tags=plg -timeout=30m -coverprofile=coverage-plg.out -covermode=atomic -coverpkg=${PKG_LIST} ./... | tee test-report-plg.out artifacts: paths: @@ -163,8 +163,9 @@ upload to sonarcloud: rules: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: - - sonar-scanner -Dsonar.projectKey=molecula_featurebase -Dsonar.organization=molecula -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.go.coverage.reportPaths=coverage-plg.out,results/coverage*.out -Dsonar.go.tests.reportPaths=test-report-plg.out,results/report* -Dsonar.javascript.lcov.reportPaths=lattice/coverage/lcov.info + - sonar-scanner -Dsonar.projectKey=molecula_featurebase -Dsonar.organization=molecula -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.go.coverage.reportPaths=coverage*.out,results/coverage*out -Dsonar.go.tests.reportPaths=test-report*.out -Dsonar.javascript.lcov.reportPaths=lattice/coverage/lcov.info needs: + - job: run go tests future plg - job: run go tests future - job: run jest tests - job: clustertests