# This is based on the following template located at: # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml # and other experimentations # 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