Skip to content
Snippets Groups Projects
Verified Commit ea4814b6 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

add CI pipeline

parent 4223e16c
Branches
Tags
1 merge request!34Feature/add linting
---
stages:
- tox
- documentation
include:
- docs/.gitlab-ci.yml
#################################### tox - Testing and linting
run-tox-pipeline:
stage: tox
tags:
- docker-executor
image: python:3.10
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/topics/caching/
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
before_script:
- pip install virtualenv
- virtualenv venv
- . venv/bin/activate
script:
- pip install tox
- tox
artifacts:
paths:
- htmlcov
---
##### Sphinx - Generate documentation
build-documentation:
stage: documentation
tags:
- docker-executor
image: sphinxdoc/sphinx:latest
before_script:
- pip install sphinx_rtd_theme
script:
- sphinx-apidoc lso lso/app.py -o docs/source -d 2 -f
- sphinx-build -b html docs/source docs/build
artifacts:
paths:
- $CI_PROJECT_DIR/docs/build/html
##### Vale - Documentation linter
lint-documentation:
stage: documentation
image:
name: jdkato/vale:latest
entrypoint: [""]
tags:
- docker-executor
needs:
- job: build-documentation # Only run when documentation has been built
artifacts: true
before_script:
- cd $CI_PROJECT_DIR/docs/vale
- vale sync
script:
- vale sync
- vale $CI_PROJECT_DIR/docs/source/*.rst $CI_PROJECT_DIR/**/*.py
#!/bin/bash
usage() {
echo "Usage: $0 <lso_collection_name> <playbook-name> <remote-host> (<extra-vars> ...)" 1>&2;
exit 2
}
if [ $# -lt 2 ]; then
echo "Illegal number of parameters"
usage
fi
VENV_PATH=$(mktemp -d -t larp-venv-)
if [[ ! -d "$VENV_PATH" ]]; then
echo "Unable to create temp directory for venv"
exit 1
fi
cleanup() {
rm -rf "$VENV_PATH"
echo "Deleted venv in $VENV_PATH"
}
# Always delete old venv upon exit
trap cleanup EXIT
###
echo "Creating venv in $VENV_PATH"
python3 -m venv "$VENV_PATH"
source "$VENV_PATH/bin/activate"
pip install -r ../requirements.txt # FIXME
pip install ansible ansible_runner
ansible-galaxy collection install "$1"
EXTRA_OPTIONS=${*:4}
ansible-playbook "$2" -i "$3", --connection=local "$EXTRA_OPTIONS" # FIXME: remove --connection=local
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment