ci(metis): anchor quality stage to workspace path
This commit is contained in:
parent
fd3efbc13a
commit
e659714335
41
Jenkinsfile
vendored
41
Jenkinsfile
vendored
@ -95,6 +95,7 @@ spec:
|
||||
}
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
buildDiscarder(logRotator(daysToKeepStr: '30', numToKeepStr: '200', artifactDaysToKeepStr: '30', artifactNumToKeepStr: '120'))
|
||||
}
|
||||
parameters {
|
||||
booleanParam(
|
||||
@ -189,12 +190,38 @@ PY
|
||||
apt-get install -y --no-install-recommends xz-utils >/dev/null
|
||||
mkdir -p build
|
||||
go install github.com/jstemmer/go-junit-report/v2@latest
|
||||
cd "${WORKSPACE}"
|
||||
docs_rc=1
|
||||
quality_rc=1
|
||||
test_rc=1
|
||||
|
||||
set +e
|
||||
cd "${WORKSPACE}/testing"
|
||||
METIS_USE_EXISTING_COVERAGE=1 go test -v -run TestExportedDocs ./...
|
||||
docs_rc=$?
|
||||
printf '%s\n' "${docs_rc}" > "${WORKSPACE}/build/docs-naming.rc"
|
||||
if [ "${docs_rc}" -eq 0 ]; then
|
||||
METIS_USE_EXISTING_COVERAGE=1 go test -v ./...
|
||||
quality_rc=$?
|
||||
fi
|
||||
cd "${WORKSPACE}"
|
||||
|
||||
if [ "${docs_rc}" -eq 0 ] && [ "${quality_rc}" -eq 0 ]; then
|
||||
go test -v -count=1 -coverprofile=build/coverage.out ./... > build/test.out 2>&1
|
||||
test_rc=$?
|
||||
fi
|
||||
set -e
|
||||
|
||||
if [ -f build/test.out ]; then
|
||||
cat build/test.out
|
||||
"$(go env GOPATH)/bin/go-junit-report" < build/test.out > "${JUNIT_XML}"
|
||||
else
|
||||
cat > "${JUNIT_XML}" <<'EOF'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites tests="0" failures="0" errors="0" skipped="0"></testsuites>
|
||||
EOF
|
||||
fi
|
||||
|
||||
coverage="0"
|
||||
if [ -f build/coverage.out ]; then
|
||||
coverage="$(go tool cover -func=build/coverage.out | awk '/^total:/ {gsub("%","",$3); print $3}')"
|
||||
@ -202,20 +229,8 @@ PY
|
||||
export GO_COVERAGE="${coverage}"
|
||||
printf '{"summary":{"percent_covered":%s}}\n' "${GO_COVERAGE}" > "${COVERAGE_JSON}"
|
||||
|
||||
quality_rc=0
|
||||
if [ "${test_rc}" -eq 0 ]; then
|
||||
set +e
|
||||
cd testing
|
||||
METIS_USE_EXISTING_COVERAGE=1 go test -v ./...
|
||||
quality_rc=$?
|
||||
set -e
|
||||
cd "${WORKSPACE}"
|
||||
else
|
||||
quality_rc=1
|
||||
fi
|
||||
|
||||
gate_rc=0
|
||||
if [ "${test_rc}" -ne 0 ] || [ "${quality_rc}" -ne 0 ]; then
|
||||
if [ "${docs_rc}" -ne 0 ] || [ "${quality_rc}" -ne 0 ] || [ "${test_rc}" -ne 0 ]; then
|
||||
gate_rc=1
|
||||
fi
|
||||
printf '%s\n' "${gate_rc}" > "${TEST_EXIT_CODE_PATH}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user