Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TOAR-II FastAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
toar-data
TOAR-II FastAPI
Commits
bc3afce7
Commit
bc3afce7
authored
4 months ago
by
Sabine Schröder
Browse files
Options
Downloads
Patches
Plain Diff
Upload run_pytest_coverage.sh from Geopeas
(author: Lukas Leufen)
parent
e9a06cf5
No related branches found
No related tags found
No related merge requests found
Pipeline
#244830
passed
4 months ago
Stage: test
Stage: deploy
Stage: pages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CI/run_pytest_coverage.sh
+44
-0
44 additions, 0 deletions
CI/run_pytest_coverage.sh
with
44 additions
and
0 deletions
CI/run_pytest_coverage.sh
0 → 100644
+
44
−
0
View file @
bc3afce7
#!/bin/bash
# run coverage twice, 1) for html deploy 2) for success evaluation
coverage run
--source
=
'.'
manage.py
test
coverage html
coverage report |
tee
coverage_results.out
IS_FAILED
=
$?
# move html coverage report
mkdir
coverage/
BRANCH_NAME
=
$(
echo
-e
"
${
CI_COMMIT_REF_NAME
////_
}
"
)
mkdir
coverage/
${
BRANCH_NAME
}
mkdir
coverage/recent
cp
-r
htmlcov/
*
coverage/
${
BRANCH_NAME
}
/.
cp
-r
htmlcov/
*
coverage/recent/.
if
[[
"
${
CI_COMMIT_REF_NAME
}
"
=
"master"
]]
;
then
cp
-r
htmlcov/
*
coverage/.
fi
# extract coverage information
COVERAGE_RATIO
=
"
$(
grep
-oP
'\d+\%'
coverage_results.out |
tail
-1
)
"
COVERAGE_RATIO
=
"
$(
echo
${
COVERAGE_RATIO
}
|
(
grep
-oP
'\d*'
)
)
"
# report
if
[[
${
IS_FAILED
}
==
0
]]
;
then
if
[[
${
COVERAGE_RATIO
}
-lt
${
COVERAGE_PASS_THRESHOLD
}
]]
;
then
echo
"only
${
COVERAGE_RATIO
}
% covered"
echo
"incomplete"
>
status.txt
echo
"
${
COVERAGE_RATIO
}
%25"
>
incomplete.txt
if
[[
${
COVERAGE_RATIO
}
-lt
${
FAILURE_THRESHOLD
}
]]
;
then
echo
-e
"
\0
33[1;31monly
${
COVERAGE_RATIO
}
% covered!!
\0
33[0m"
exit
1
fi
else
echo
"passed"
echo
"success"
>
status.txt
echo
"
${
COVERAGE_RATIO
}
%25"
>
success.txt
fi
exit
0
else
echo
"not passed"
exit
1
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment