67 lines
1.2 KiB
YAML
67 lines
1.2 KiB
YAML
image: python:3.13
|
|
|
|
stages:
|
|
- lint
|
|
- test
|
|
- build
|
|
|
|
variables:
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
|
|
UV_CACHE_DIR: "$CI_PROJECT_DIR/.uv-cache"
|
|
|
|
# Cache dependencies between jobs
|
|
cache:
|
|
paths:
|
|
- .pip-cache/
|
|
- .uv-cache/
|
|
- .venv/
|
|
|
|
before_script:
|
|
- curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
- export PATH="$HOME/.cargo/bin:$PATH"
|
|
- uv venv .venv
|
|
- source .venv/bin/activate
|
|
- uv pip install -r requirements.txt
|
|
|
|
lint:
|
|
stage: lint
|
|
script:
|
|
- uv pip install ruff
|
|
- ruff check .
|
|
- ruff format --check .
|
|
|
|
test:
|
|
stage: test
|
|
script:
|
|
- uv pip install pytest pytest-cov
|
|
- pytest --cov=./ --cov-report=xml
|
|
artifacts:
|
|
reports:
|
|
coverage_report:
|
|
coverage_format: cobertura
|
|
path: coverage.xml
|
|
|
|
dependency-check:
|
|
stage: lint
|
|
script:
|
|
- uv pip install pip-audit
|
|
- pip-audit
|
|
allow_failure: true
|
|
|
|
workflow:
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
build:
|
|
stage: build
|
|
script:
|
|
- uv pip install build
|
|
- python -m build
|
|
artifacts:
|
|
paths:
|
|
- dist/
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|