-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
83 lines (77 loc) · 1.85 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
83 lines (77 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
stages:
- lint
- unit
- integration
- build
- smoke
variables:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_CACHE_DIR: "1"
lint:
stage: lint
image: python:3.12-slim
script:
- python -m pip install -e ".[dev]"
- python -m ruff check app tests scripts/smoke.py
- python -m mypy app
- python -m bandit -q -r app
unit:
stage: unit
image: python:3.12-slim
script:
- python -m pip install -e ".[dev]"
- python -m pytest -m "not integration" --cov=app --cov-fail-under=80
integration:
stage: integration
image: python:3.12-slim
services:
- name: docker:27.3.1-dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
script:
- python -m pip install -e ".[dev]"
- python -m pytest -m integration -q
after_script:
- docker compose down -v || true
build:
stage: build
image: docker:27.3.1
services:
- name: docker:27.3.1-dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
script:
- docker build -t "logscope:${CI_COMMIT_SHA}" .
after_script:
- docker compose down -v || true
smoke:
stage: smoke
image: docker:27.3.1
services:
- name: docker:27.3.1-dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
LOGSCOPE_URL: http://docker:8080
before_script:
- apk add --no-cache python3
script:
- docker compose up -d --build
- |
api_id="$(docker compose ps -q api)"
for attempt in $(seq 1 60); do
health="$(docker inspect --format='{{.State.Health.Status}}' "$api_id" 2>/dev/null || true)"
if [ "$health" = "healthy" ]; then exit 0; fi
sleep 2
done
docker compose ps
docker compose logs api
exit 1
- python3 scripts/smoke.py
after_script:
- docker compose down -v || true