canaille-globuzma/.gitlab-ci.yml
2024-12-19 10:40:06 +01:00

79 lines
2 KiB
YAML

---
stages:
- test
- build
- release
variables:
UV_VERSION: 0.4
UV_CACHE_DIR: .uv-cache
BASE_LAYER: bookworm-slim
cache:
- key:
files:
- uv.lock
paths:
- $UV_CACHE_DIR
before_script:
- apt update
- env DEBIAN_FRONTEND=noninteractive apt install --yes --quiet gcc python3-dev libldap2-dev libsasl2-dev libssl-dev slapd ldap-utils git curl
# Rust is needed to install the zxcvbn dependency
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- export PATH="$HOME/.cargo/bin:$PATH"
style:
variables:
PYTHON_VERSION: "3.13"
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
stage: test
script:
- uv sync --all-extras
- uv run pre-commit run --all-files --show-diff-on-failure
- uv cache prune --ci
coverage:
variables:
PYTHON_VERSION: "3.12"
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
stage: test
script:
- uv sync --all-extras
- uv pip install coveralls pyyaml tomli
- uv run pytest --cov --cov-fail-under=100 --cov-report term:skip-covered -n auto
- uv run coveralls
- uv cache prune --ci
tests:
needs: ["coverage", "style"]
parallel:
matrix:
- PYTHON_VERSION: ['3.10', '3.11', '3.12']
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
stage: test
script:
- uv sync --all-extras
- uv run pytest
- uv cache prune --ci
minversions:
needs: ["tests"]
variables:
PYTHON_VERSION: "3.10"
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
stage: test
script:
- uv sync --all-extras --resolution=lowest-direct
- uv run pytest
- uv cache prune --ci
doc:
variables:
PYTHON_VERSION: "3.13"
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
stage: test
script:
- uv sync --group doc --all-extras
- uv run sphinx-build doc build/sphinx/html --fail-on-warning
- uv cache prune --ci