Commit 5eff666f authored by Joseph Siddons's avatar Joseph Siddons
Browse files

ci: add gitlab-ci and pre-commit-config files

parent 66b37c82
variables:
UV_VERSION: 0.5
PYTHON_VERSION: 3.12
BASE_LAYER: bookworm-slim
UV_CACHE_DIR: .uv-cache
UV_SYSTEM_PYTHON: 1
stages:
- build
- test
- lint
pre-commit:
stage: build
image: python:3.11
script:
- pip install pre-commit
- pre-commit run --all-files
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main"
pytest:
stage: test
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
cache:
- key:
files:
- uv.lock
paths:
- $UV_CACHE_DIR
script:
- uv --version
- uv sync --all-extras
- uv pip list
- uv run pytest test
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main"
ruff:
stage: lint
interruptible: true
image:
name: ghcr.io/astral-sh/ruff:0.9.9-alpine
before_script:
- cd $CI_PROJECT_DIR
- ruff --version
script:
- ruff check --output-format=gitlab > code-quality-report.json
artifacts:
reports:
codequality: $CI_PROJECT_DIR/code-quality-report.json
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.5
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment