You've already forked RekomenciBackend
feat: added e2e, unit tests and improved tests pipeline
This commit is contained in:
+53
-12
@@ -14,12 +14,15 @@ variables:
|
||||
TRIVY_USERNAME: $CI_REGISTRY_USER
|
||||
TRIVY_PASSWORD: $CI_REGISTRY_PASSWORD
|
||||
TRIVY_REGISTRY: $CI_REGISTRY
|
||||
UV_PROJECT_ENVIRONMENT: .venv
|
||||
UV_CACHE_DIR: .cache/uv
|
||||
|
||||
cache:
|
||||
key: "${CI_COMMIT_REF_SLUG}"
|
||||
paths:
|
||||
- .cache/pip
|
||||
- .cache/trivy
|
||||
- $TRIVY_CACHE_DIR
|
||||
- $UV_CACHE_DIR
|
||||
- $UV_PROJECT_ENVIRONMENT
|
||||
policy: pull-push
|
||||
|
||||
.docker-job: &docker-job
|
||||
@@ -138,6 +141,21 @@ cache:
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
.uv-job: &uv-job
|
||||
image: debian:trixie-slim
|
||||
cache:
|
||||
key: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}"
|
||||
paths:
|
||||
- $UV_PROJECT_ENVIRONMENT
|
||||
- $UV_CACHE_DIR
|
||||
policy: pull-push
|
||||
before_script:
|
||||
- apt-get update
|
||||
- apt-get install -y --no-install-recommends ca-certificates curl just
|
||||
- update-ca-certificates
|
||||
- curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
sast-filesystem:
|
||||
<<: *trivy-fs-scan
|
||||
|
||||
@@ -186,7 +204,19 @@ build-migrations:
|
||||
CONTAINERFILE: Containerfile
|
||||
BUILDTARGET: migrations
|
||||
|
||||
test-e2e:
|
||||
lint:
|
||||
<<: *uv-job
|
||||
stage: test
|
||||
script:
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- uv sync --group linters --frozen
|
||||
- just lint
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
||||
test:
|
||||
<<: *docker-job
|
||||
stage: test
|
||||
variables:
|
||||
@@ -220,13 +250,19 @@ test-e2e:
|
||||
exit 1
|
||||
fi
|
||||
- |
|
||||
docker compose -f compose.yaml -f compose.prod.yaml $PROFILES down
|
||||
docker compose -f compose.yaml $PROFILES down
|
||||
- cat .cov/coverage.txt
|
||||
artifacts:
|
||||
paths:
|
||||
- ./.cov
|
||||
- ./compose.log
|
||||
reports:
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: .cov/coverage.xml
|
||||
expire_in: 1 week
|
||||
when: always
|
||||
coverage: /TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||
@@ -235,22 +271,27 @@ test-e2e:
|
||||
- build-tests
|
||||
- build-migrations
|
||||
|
||||
webhook-backend-deploy:
|
||||
<<: *webhook-config
|
||||
variables:
|
||||
WEBHOOK_URL: $WEBHOOK_URL_BACKEND
|
||||
dependencies:
|
||||
- build-runtime
|
||||
- sast-image-runtime
|
||||
|
||||
webhook-migrations-deploy:
|
||||
<<: *webhook-config
|
||||
variables:
|
||||
WEBHOOK_URL: $WEBHOOK_URL_MIGRATIONS
|
||||
resource_group: staging
|
||||
dependencies:
|
||||
- build-migrations
|
||||
- sast-image-migrations
|
||||
|
||||
webhook-backend-deploy:
|
||||
<<: *webhook-config
|
||||
variables:
|
||||
WEBHOOK_URL: $WEBHOOK_URL_BACKEND
|
||||
environment:
|
||||
name: staging
|
||||
url: https://hackaton.paas.itqdev.xyz
|
||||
resource_group: staging
|
||||
dependencies:
|
||||
- build-runtime
|
||||
- sast-image-runtime
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
|
||||
Reference in New Issue
Block a user