opnsense-prom-exporter/.gitlab-ci.yml

82 lines
1.8 KiB
YAML
Raw Permalink Normal View History

2023-09-01 14:44:13 +02:00
# This is based on the following template located at:
2023-09-01 13:55:08 +02:00
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
2023-09-01 14:44:13 +02:00
# and other experimentations
2023-09-01 13:55:08 +02:00
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: python:latest
# 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
- venv/
before_script:
- python --version ; pip --version # For debugging
- pip install virtualenv
2023-09-01 13:55:08 +02:00
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.dev.txt
2023-09-01 13:55:08 +02:00
stages:
- lint
- build
- test
- release
lint:
stage: lint
script:
- pre-commit install --install-hooks
- pre-commit run --all-files --show-diff-on-failure
needs: []
build:
stage: build
script:
- rm -rf dist/
- python setup.py sdist bdist_wheel
- twine check dist/*
- pip install dist/*.whl
- opnsense-exporter --help
- pip install -e .
needs: []
artifacts:
paths:
- dist/
test:
stage: test
2023-09-01 15:57:07 +02:00
coverage: '/\d+\%\s*$/'
2023-09-01 13:55:08 +02:00
script:
- pip install --editable ".[test]"
- pytest
artifacts:
reports:
2023-09-01 14:46:25 +02:00
coverage_report:
coverage_format: cobertura
path: ./coverage.xml
junit: ./junit.xml
2023-09-01 13:55:08 +02:00
paths:
2023-09-01 14:46:25 +02:00
- ./htmlcov/
2023-09-01 13:55:08 +02:00
needs: [build]
pypi-release:
stage: release
script:
- twine upload --verbose dist/*
needs: ["build", "lint", "test"]
only:
- tags