Removed the subdir.
This commit is contained in:
196
pyrate/.gitlab-ci.yml
Normal file
196
pyrate/.gitlab-ci.yml
Normal file
@ -0,0 +1,196 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Base image
|
||||
image: ubuntu:22.04
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Caches & Environment variables
|
||||
variables:
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||
|
||||
cache:
|
||||
# Share cache among commits on the same branch
|
||||
key: ${CI_COMMIT_REF_SLUG}
|
||||
paths:
|
||||
- .cache/pip
|
||||
- .cache/apt
|
||||
# cache these such that subsequent invocations test at least the previous examples
|
||||
- .hypothesis/examples
|
||||
# mypy works incrementally
|
||||
- .mypy_cache
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Config
|
||||
stages:
|
||||
- Static Code Analysis
|
||||
- Automatic Testing
|
||||
- Manual Testing
|
||||
- Documentation
|
||||
- Deploy
|
||||
|
||||
default:
|
||||
timeout: 15 minutes
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Static Code Analysis
|
||||
Pylint:
|
||||
image: python:3.10
|
||||
stage: Static Code Analysis
|
||||
needs: []
|
||||
before_script:
|
||||
- pip install "pylint~=2.13.4"
|
||||
script:
|
||||
- pylint -j 0 pyrate tests scripts | awk '!seen[$0]++'
|
||||
|
||||
Flake8 Linter:
|
||||
image: python:3.10
|
||||
stage: Static Code Analysis
|
||||
needs: []
|
||||
before_script:
|
||||
- pip install hacking # This also installs flake8, mccabe and others
|
||||
script:
|
||||
- flake8 | awk '!seen[$0]++'
|
||||
|
||||
Mypy Static Type Checker:
|
||||
stage: Static Code Analysis
|
||||
needs: []
|
||||
before_script:
|
||||
# (This section is partly copied from the Pytest job)
|
||||
|
||||
# Setup APT cache based on
|
||||
# https://gitlab.com/gitlab-org/gitlab-runner/issues/991#note_126864314
|
||||
- rm -f /etc/apt/apt.conf.d/docker-clean
|
||||
- mkdir -p .cache/apt && mkdir /var/cache/apt/archives && mount --bind .cache/apt /var/cache/apt/archives/
|
||||
|
||||
# Install Pip & additional requirements that cannot be fulfilled with pip
|
||||
- apt-get update -qq
|
||||
- apt-get install -qqy python3-pip g++ python3-dev python3-gdal libgdal-dev
|
||||
|
||||
# Print version information and install Pyrate
|
||||
- python3 --version
|
||||
- pip3 install .
|
||||
script:
|
||||
- mypy pyrate tests scripts
|
||||
|
||||
Black Linter:
|
||||
image: python:3.10
|
||||
stage: Static Code Analysis
|
||||
needs: []
|
||||
before_script:
|
||||
- pip install black
|
||||
script:
|
||||
- black --check --diff .
|
||||
# Black is allowed to fail since we do not strictly enforce its advice
|
||||
allow_failure: true
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Automatic Testing
|
||||
Pytest:
|
||||
stage: Automatic Testing
|
||||
needs: []
|
||||
timeout: 3 hours
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Setup & Installation
|
||||
before_script:
|
||||
# Setup APT cache based on
|
||||
# https://gitlab.com/gitlab-org/gitlab-runner/issues/991#note_126864314
|
||||
- rm -f /etc/apt/apt.conf.d/docker-clean
|
||||
- mkdir -p .cache/apt && mkdir /var/cache/apt/archives && mount --bind .cache/apt /var/cache/apt/archives/
|
||||
|
||||
# Install Pip & additional requirements that cannot be fulfilled with pip
|
||||
- apt-get update -qq
|
||||
- apt-get install software-properties-common -qqy
|
||||
- add-apt-repository ppa:antiprism/ppa -y
|
||||
- apt-get install -qqy python3-pip g++ python3-dev python3-gdal libgdal-dev libsqlite3-mod-spatialite antiprism
|
||||
|
||||
# Print version information and install Pyrate
|
||||
- python3 --version
|
||||
- pip3 install .
|
||||
script:
|
||||
# Run the tests and collect coverage
|
||||
- pytest --junitxml=.test-artifacts.junit.xml
|
||||
|
||||
# Convert the coverage report extra (instead of with --cov-report xml:coverage.xml) to correct the source paths
|
||||
# This is for Gitlab to automatically parse it
|
||||
- python3 -m coverage xml
|
||||
|
||||
# Make sure to crash at less than 100% statement coverage
|
||||
- python3 -m coverage json
|
||||
- echo Checking for 100.00% statement coverage ...
|
||||
- >
|
||||
cat coverage.json | python3 -c $'import json, sys; miss = bool(json.load(sys.stdin)["totals"]["missing_lines"])\nif miss: sys.exit("\033[91m\033[01mERROR: Statement Coverage is <100%.\033[0m");'
|
||||
coverage: '/^TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+.\d+\%)/'
|
||||
artifacts:
|
||||
reports:
|
||||
junit: .test-artifacts.junit.xml
|
||||
cobertura: coverage.xml
|
||||
|
||||
Mutation Testing:
|
||||
extends: Pytest
|
||||
stage: Manual Testing
|
||||
needs: [Pytest, Mypy Static Type Checker] # Always make sure that the normal tests run fine!
|
||||
timeout: 3 days # This can take very long, since the test suite might get run many times
|
||||
when: manual
|
||||
script:
|
||||
- pip3 install mutmut
|
||||
- mutmut run --no-progress # Update less regularly
|
||||
- mutmut results
|
||||
- mutmut html
|
||||
artifacts:
|
||||
reports: {}
|
||||
paths:
|
||||
- html/
|
||||
expire_in: 500 days
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Documentation
|
||||
|
||||
Build Documentation:
|
||||
stage: Documentation
|
||||
needs: []
|
||||
retry: # Needed due to random "std::bad_alloc" occurrences
|
||||
max: 2
|
||||
when: script_failure
|
||||
before_script:
|
||||
# Installation as in the "Pytest" job
|
||||
# Setup APT cache based on
|
||||
# https://gitlab.com/gitlab-org/gitlab-runner/issues/991#note_126864314
|
||||
- rm -f /etc/apt/apt.conf.d/docker-clean
|
||||
- mkdir -p .cache/apt && mkdir /var/cache/apt/archives && mount --bind .cache/apt /var/cache/apt/archives/
|
||||
|
||||
# Setup pip
|
||||
- apt-get update -qq
|
||||
- apt-get install -qqy python3-pip
|
||||
|
||||
# Install additional requirements that cannot be fulfilled with pip
|
||||
- apt-get install -qqy g++ python3-dev python3-gdal libgdal-dev libsqlite3-mod-spatialite
|
||||
|
||||
# Print version information and install Pyrate
|
||||
- python3 --version
|
||||
- pip3 install .[docs]
|
||||
|
||||
# Install additional requirements specifically for the documentation
|
||||
- apt-get -qqy install graphviz
|
||||
script:
|
||||
- cd doc
|
||||
- make html # only build HTML as it supports all features, is fast and required for the Gitlab pages website
|
||||
artifacts:
|
||||
paths:
|
||||
- doc/build/html/
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~ Deploy
|
||||
|
||||
# This job is separate from "Build Documentation" job since this one shall only run on the master branch while the other
|
||||
# should run as part of all pipelines
|
||||
pages:
|
||||
image: alpine:latest
|
||||
stage: Deploy
|
||||
needs: [Build Documentation]
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- mkdir public
|
||||
- cp -R doc/build/html/* public/
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
|
||||
# This job triggers the pipeline of the ros-nodes repository on changes of the master branch
|
||||
Trigger Downstream Pipelines:
|
||||
# needs: [] although this does not really require other jobs, it shall only be run at the end if all others succeeded
|
||||
stage: Deploy
|
||||
only:
|
||||
- master
|
||||
trigger: informatik/ros-nodes
|
Reference in New Issue
Block a user