-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
74 lines (68 loc) · 1.74 KB
/
.gitlab-ci.yml
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
variables:
SQL_HOST: 'db'
SQL_PORT: '5432'
DATABASE: 'postgres'
APP_FOLDER: '/usr/src/app/tmtar'
image: docker:stable
services:
- docker:dind
stages:
- build
- test
- release
build:
stage: build
tags:
- docker
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD registry.gitlab.com
script:
- docker pull registry.gitlab.com/baltazar1697/tmtar_api || true
- docker build --cache-from registry.gitlab.com/baltazar1697/tmtar_api -t registry.gitlab.com/baltazar1697/tmtar_api:$CI_BUILD_REF --tag registry.gitlab.com/baltazar1697/tmtar_api:latest --tag registry.gitlab.com/baltazar1697/tmtar_api services/web/
- docker push registry.gitlab.com/baltazar1697/tmtar_api:$CI_BUILD_REF
- docker push registry.gitlab.com/baltazar1697/tmtar_api:latest
only:
- master
codestyle-check:
stage: test
allow_failure: true
image: python:3.9.5-slim-buster
before_script:
- pip3 install wemake-python-styleguide flake8
script:
- flake8 --tee --output-file=codestyle.log .
artifacts:
when: always
paths:
- codestyle.log
expire_in: 1 week
# only:
# - api_dev
test:
stage: test
before_script:
- apk add --no-cache docker-compose
script:
- docker-compose -f docker-compose.test.yml up -d
after_script:
- docker-compose down
artifacts:
when: always
reports:
junit: services/web/report.xml
expire_in: 1 day
# only:
# - api_dev
deploy:
stage: release
before_script:
- apk add --no-cache docker-compose
script:
- docker-compose -f docker-compose.prod.yml up -d --build
# - docker-compose exec web python manage.py db upgrade
after_script:
- docker-compose down
needs:
- job: build
only:
- master