mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
closes #3407 - Added code coverage reporting to the CI pipeline
This commit is contained in:
parent
15b55f5e62
commit
a6511632ad
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ fabfile.py
|
|||||||
gunicorn_config.py
|
gunicorn_config.py
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.vscode
|
.vscode
|
||||||
|
.coverage
|
||||||
|
@ -10,6 +10,7 @@ python:
|
|||||||
install:
|
install:
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- pip install pycodestyle
|
- pip install pycodestyle
|
||||||
|
- pip install coverage
|
||||||
before_script:
|
before_script:
|
||||||
- psql --version
|
- psql --version
|
||||||
- psql -U postgres -c 'SELECT version();'
|
- psql -U postgres -c 'SELECT version();'
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
v2.7.0 (FUTURE)
|
||||||
|
|
||||||
|
## Housekeeping
|
||||||
|
|
||||||
|
* [#3407](https://github.com/netbox-community/netbox/issues/3407) - Added code coverage reporting to the CI pipeline
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
v2.6.3 (FUTURE)
|
v2.6.3 (FUTURE)
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
@ -41,13 +41,21 @@ sed -i -e "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['*'\]/g" $CONFIG
|
|||||||
sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = 'netboxci'/g" $CONFIG
|
sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = 'netboxci'/g" $CONFIG
|
||||||
|
|
||||||
# Run NetBox tests
|
# Run NetBox tests
|
||||||
./netbox/manage.py test netbox/
|
coverage run --source="netbox/" netbox/manage.py test netbox/
|
||||||
RC=$?
|
RC=$?
|
||||||
if [[ $RC != 0 ]]; then
|
if [[ $RC != 0 ]]; then
|
||||||
echo -e "\n$(info) one or more tests failed, failing build."
|
echo -e "\n$(info) one or more tests failed, failing build."
|
||||||
EXIT=$RC
|
EXIT=$RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Show code coverage report
|
||||||
|
coverage report --skip-covered --omit *migrations*
|
||||||
|
RC=$?
|
||||||
|
if [[ $RC != 0 ]]; then
|
||||||
|
echo -e "\n$(info) failed to generate code coverage report."
|
||||||
|
EXIT=$RC
|
||||||
|
fi
|
||||||
|
|
||||||
# Show build duration
|
# Show build duration
|
||||||
END=$(date +%s)
|
END=$(date +%s)
|
||||||
echo "$(info) exiting with code $EXIT after $(($END - $START)) seconds."
|
echo "$(info) exiting with code $EXIT after $(($END - $START)) seconds."
|
||||||
|
Loading…
Reference in New Issue
Block a user