first CI setup
This commit is contained in:
parent
9270bc08f0
commit
c4bdd68d4c
1 changed files with 76 additions and 0 deletions
76
.gitlab-ci.yaml
Normal file
76
.gitlab-ci.yaml
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
# This is based on the follwing template located at:
|
||||||
|
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
|
||||||
|
|
||||||
|
# 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 twine wheel
|
||||||
|
- virtualenv venv
|
||||||
|
- source venv/bin/activate
|
||||||
|
|
||||||
|
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
|
||||||
|
script:
|
||||||
|
- pip install --editable ".[test]"
|
||||||
|
- pytest
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
cobertura: coverage.xml
|
||||||
|
junit: junit.xml
|
||||||
|
paths:
|
||||||
|
- .coverage.test
|
||||||
|
needs: [build]
|
||||||
|
|
||||||
|
|
||||||
|
pypi-release:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- twine upload --verbose dist/*
|
||||||
|
needs: ["build", "lint", "test"]
|
||||||
|
only:
|
||||||
|
- tags
|
Loading…
Reference in a new issue