Skip to content
Snippets Groups Projects

Added CI

3 files
+ 64
1
Compare changes
  • Side-by-side
  • Inline

Files

.gitlab-ci.yml 0 → 100644
+ 56
0
stages:
- test
- lint
- coverage
variables:
PYLINT_CMD: >
(pylint grext --exit-zero > pylint.out) || true
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
default:
image: python:latest
cache:
paths:
- .cache/pip
before_script:
- python -V
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install .
- pip install pylint anybadge coverage
tags:
- Maths
test:
stage: test
script:
- coverage run -m pytest
artifacts:
paths:
- .coverage
lint:
stage: lint
script:
- mkdir -p ./public
- pylint grext --exit-zero | tee pylint.out
- score=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.out)
- echo "Pylint score was $score"
- anybadge --value=$score --file=public/pylint_badge.svg pylint
- echo $score | awk '{if( $1 > 8.0 ) exit 0; exit 1;}'
artifacts:
paths:
- public/pylint_badge.svg
coverage:
stage: coverage
script:
- mkdir -p ./public
- coverage report | tee report.out
- covperc=`cat report.out | grep 'TOTAL' | sed -e 's/%//g' | awk '{print $4}'`
- anybadge --value=$covperc --file=public/coverage.svg coverage
artifacts:
paths:
- public/coverage.svg
Loading