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