From 7e55bf0cb1a6cfcd671c38b17576a58422921b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Mon, 1 Oct 2018 13:47:52 +0200 Subject: [PATCH 1/2] core -- Add code coverage to CI --- .gitignore | 1 + .gitlab-ci.yml | 5 ++++- README.md | 1 + setup.cfg | 16 ++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index ab791b2e..2f3d166c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ venv/ media/ *.log *.sqlite3 +.coverage # PyCharm .idea diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0ced08d..e5efbf5b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,9 +36,12 @@ before_script: # Remove the old test database if it has not been done yet - psql --username=$POSTGRES_USER --host=$DBHOST -c "DROP DATABASE IF EXISTS test_$POSTGRES_DB" - pip install --upgrade --cache-dir vendor/pip -t vendor/python -r requirements.txt + - pip install coverage - python --version test: stage: test script: - - python manage.py test + - coverage run manage.py test + - coverage report + coverage: '/TOTAL.*\s(\d+\.\d+)\%$/' diff --git a/README.md b/README.md index a0dc5bc1..803ef21f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # GestioCOF ![build_status](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/build.svg) +[![coverage report](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/coverage.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master) ## Installation diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..35eb701a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,16 @@ +[coverage:run] +source = + bda + cof + gestioncof + kfet + shared + utils +omit = + *migrations* + *test*.py +branch = true + +[coverage:report] +precision = 2 +show_missing = true From 6c5b7ed5cc53525ee7e27f3bcaeab5c3ba1f3ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Mon, 1 Oct 2018 13:56:07 +0200 Subject: [PATCH 2/2] core -- Update CI badge for current GitLab version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 803ef21f..524e558d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GestioCOF -![build_status](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/build.svg) +[![pipeline status](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/pipeline.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master) [![coverage report](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/coverage.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master) ## Installation