forked from unicamp-mc426/2023-s1-ci
-
Notifications
You must be signed in to change notification settings - Fork 78
/
.gitlab-ci.yml
118 lines (108 loc) · 2.64 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
variables:
DOCKER_DRIVER: overlay2
stages:
- lint
- test
- build
- release
- deploy
lint flake8:
stage: lint
image:
name: python:3.7.5-slim
pull_policy: if-not-present
script:
- flake8 .
before_script:
- pip install --no-cache-dir --upgrade -r requirements-dev.txt
lint black:
stage: lint
image:
name: python:3.7.5-slim
pull_policy: if-not-present
script:
- black --check .
before_script:
- pip install --no-cache-dir --upgrade -r requirements-dev.txt
lint prospector:
stage: lint
image:
name: python:3.7.5-slim
pull_policy: if-not-present
script:
- prospector --no-autodetect
before_script:
- pip install --no-cache-dir --upgrade -r requirements-dev.txt
lint pip-audit:
stage: lint
image:
name: python:3.7.5-slim
pull_policy: if-not-present
script:
- pip-audit
before_script:
- pip install --no-cache-dir --upgrade -r requirements-dev.txt
test webapp:
stage: test
except:
- tags
image:
name: python:3.7.5-slim
pull_policy: if-not-present
script:
- coverage run -m pytest
- coverage report
- coverage xml
before_script:
- pip install --no-cache-dir --upgrade -r requirements-dev.txt
- cd simple_web_app
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
paths:
- coverage.xml
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
.build webapp:
stage: build
except:
- tags
image:
name: docker:stable
pull_policy: if-not-present
services:
- name: docker:dind
script:
- docker build -t $docker_hub_login/simple_web_app:$CI_COMMIT_SHA .
.release webapp:
stage: release
except:
- tags
image:
name: docker:stable
pull_policy: if-not-present
services:
- name: docker:dind
script:
- docker tag $docker_hub_login/simple_web_app:$CI_COMMIT_SHA $docker_hub_login/simple_web_app:latest
- docker push $docker_hub_login/simple_web_app:$CI_COMMIT_SHA
- docker push $docker_hub_login/simple_web_app:latest
before_script:
- docker login -u=$docker_hub_login -p=$docker_hub_token
deploy production:
stage: deploy
image:
name: curlimages/curl:7.86.0
pull_policy: if-not-present
when: manual
before_script:
- curl -fsSL https://get.deta.dev/cli.sh | sh
- cd simple_web_app
only:
- main
script:
- ~/.deta/bin/deta deploy
environment:
name: production
url: $PRODUCTION_URL