diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 60b0f2d07d93516485792990aeeab94939eb0e86..a87e40871e6860cb1f4a8e813ddbdb35912aadc2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ cache: before_script: - python -V # Print out python version for debugging -# Our main CI test script +# Run python unittests (and report coverage) test: stage: test only: [branches, tags, merge_requests] @@ -30,7 +30,7 @@ test: script: # Install python testing dependencies - - pip install --cache-dir="$PIP_CACHE_DIR" mypy pycodestyle unittest-xml-reporting coverage + - pip install --cache-dir="$PIP_CACHE_DIR" unittest-xml-reporting coverage - pip install --cache-dir="$PIP_CACHE_DIR" -r requirements.txt # Setup test config and CouchDB database server - echo -e "[couchdb]\nurl = http://couchdb:5984" > test/test_config.ini @@ -39,16 +39,30 @@ test: - export PYTHONPATH=".:$PYTHONPATH" # Run tests - coverage run --source aas --branch -m xmlrunner -o testreports - # Report test coverage; check typing and codestyle + # Report test coverage - coverage report -m - - mypy aas test - - python -m pycodestyle --count --max-line-length 120 aas test artifacts: reports: junit: testreports/*.xml +# Run static code analysis with MyPy and PyCodestyle +static_analysis: + stage: test + only: [branches, tags, merge_requests] + inherit: + variables: ["PIP_CACHE_DIR"] + + script: + # Install python testing dependencies + - pip install --cache-dir="$PIP_CACHE_DIR" mypy pycodestyle + - pip install --cache-dir="$PIP_CACHE_DIR" -r requirements.txt + # Check typing und code style + - mypy aas test + - pycodestyle --count --max-line-length 120 aas test + + # Use setup.py to build a source distribution package package: stage: package diff --git a/README.md b/README.md index 5d515c30f026662a7baa89ed66167d6af01f9ec5..d101456566f83cff80e719d4dbfc07871256908a 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ pip install mypy pycodestyle Running all checks: ```bash mypy aas test -python -m pycodestyle --max-line-length 120 aas test +pycodestyle --max-line-length 120 aas test python -m unittest ```