-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
71 lines (64 loc) · 1.77 KB
/
.gitlab-ci.yml
File metadata and controls
71 lines (64 loc) · 1.77 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
workflow:
rules:
- changes:
- server/**/*
- .gitlab-ci.yml
- when: never
stages:
- test
- build
variables:
MARIADB_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "tam"
DB_HOST: "mariadb"
REDIS_HOST: "redis"
REDIS_PORT: "6379"
DOCKER_DRIVER: overlay2
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .cache/pip/
services:
- name: mariadb:latest
alias: mariadb
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_uca1400_as_ci"
- name: redis:latest
alias: redis
command: ["redis-server", "--requirepass", "root"]
before_script:
- apt-get update && apt-get install -y python3-pip python3-venv
- python3 -m venv venv
- source venv/bin/activate
- pip install --cache-dir $PIP_CACHE_DIR pytest pytest-dependency
- pip install --cache-dir $PIP_CACHE_DIR -r server/app/requirements.txt
- pytest -k test_init_database
test:
stage: test
script:
- cd server
- pytest -n auto --dist=loadfile -v --junitxml=pytest-report.xml
artifacts:
reports:
junit: server/pytest-report.xml
docker_build:
stage: build
image: docker:latest
rules:
- if: '$CI_COMMIT_REF_NAME == "develop"'
changes:
- server/app/**/*
- when: never
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
services:
- name: docker:dind
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
script:
- docker pull $CI_REGISTRY_IMAGE/backend-dev:latest || true
- docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from "$CI_REGISTRY_IMAGE/backend-dev:latest" -t "$CI_REGISTRY_IMAGE/backend-dev:latest" server/app/
- docker push "$CI_REGISTRY_IMAGE/backend-dev:latest"