Adding CI/CD
This commit is contained in:
@@ -5,15 +5,81 @@
|
||||
# Container Scanning customization: https://docs.gitlab.com/user/application_security/container_scanning/#customizing-analyzer-behavior
|
||||
# Note that environment variables can be set in several places
|
||||
# See https://docs.gitlab.com/ci/variables/#cicd-variable-precedence
|
||||
default:
|
||||
image: python:3.13-slim
|
||||
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- pyproject.toml
|
||||
paths:
|
||||
- .cache/pip
|
||||
- .venv/
|
||||
|
||||
stages:
|
||||
- test
|
||||
- secret-detection
|
||||
- install
|
||||
- check
|
||||
- test
|
||||
- secret-detection
|
||||
|
||||
sast:
|
||||
stage: test
|
||||
|
||||
include:
|
||||
- template: Security/SAST.gitlab-ci.yml
|
||||
- template: Security/Secret-Detection.gitlab-ci.yml
|
||||
- template: Security/SAST.gitlab-ci.yml
|
||||
- template: Security/Secret-Detection.gitlab-ci.yml
|
||||
|
||||
variables:
|
||||
SECRET_DETECTION_ENABLED: 'true'
|
||||
SECRET_DETECTION_ENABLED: "true"
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||
POETRY_VERSION: "1.8.3"
|
||||
POETRY_VIRTUALENVS_IN_PROJECT: "true"
|
||||
|
||||
secret_detection:
|
||||
stage: secret-detection
|
||||
|
||||
install:
|
||||
stage: install
|
||||
script:
|
||||
- pip install poetry==$POETRY_VERSION
|
||||
- poetry install --no-interaction
|
||||
artifacts:
|
||||
paths:
|
||||
- .venv/
|
||||
expire_in: 1 hour
|
||||
|
||||
black:
|
||||
stage: check
|
||||
needs: [install]
|
||||
script:
|
||||
- pip install poetry==$POETRY_VERSION
|
||||
- poetry run black --check src/ tests/
|
||||
|
||||
ruff:
|
||||
stage: check
|
||||
needs: [install]
|
||||
script:
|
||||
- pip install poetry==$POETRY_VERSION
|
||||
- poetry run ruff check src/ tests/
|
||||
|
||||
mypy:
|
||||
stage: check
|
||||
needs: [install]
|
||||
script:
|
||||
- pip install poetry==$POETRY_VERSION
|
||||
- poetry run mypy src/
|
||||
|
||||
pytest:
|
||||
stage: test
|
||||
needs: [install]
|
||||
script:
|
||||
- pip install poetry==$POETRY_VERSION
|
||||
- poetry run pytest
|
||||
coverage: '/TOTAL.*\s+(\d+%)$/'
|
||||
artifacts:
|
||||
reports:
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: coverage.xml
|
||||
when: always
|
||||
expire_in: 7 days
|
||||
|
||||
Reference in New Issue
Block a user