forked from ejplatform/ej-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
121 lines (113 loc) · 3.29 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
118
119
120
121
stages:
- style
- linter
- unit tests
- build
- deploy
- e2e tests
variables:
GITLAB_EJ_TOKEN: "gitlab+deploy-token-533883:51xTbvyHGmEfeZZUxUct"
black:
stage: style
image:
name: python:3.9.19-slim-bookworm
pull_policy: if-not-present
before_script:
- /bin/bash -c "pip install black==22.12.0"
script:
- /bin/bash -c "black --check ."
tags:
- k8s
ruff:
stage: linter
image:
name: python:3.9.19-slim-bookworm
pull_policy: if-not-present
before_script:
- /bin/bash -c "pip install ruff==0.3.7"
script:
- /bin/bash -c "ruff check"
tags:
- k8s
pytest:
stage: unit tests
image:
name: python:3.9.19-slim-bookworm
pull_policy: if-not-present
before_script:
- apt-get update && apt-get install curl libpq-dev gcc g++ libjpeg-dev zlib1g-dev git -y
script:
- cd /builds/pencillabs/ej/ej-application
- curl -sSL https://install.python-poetry.org | python3 -
- export PATH="/root/.local/bin:$PATH"
- poetry install --with main,dev --no-root
- poetry run inv docs
- poetry run inv test
tags:
- k8s
build_dev_image:
stage: build
image:
name: docker
pull_policy: if-not-present
before_script:
- apk update && apk add bash py3-pip
- docker info
script:
- cd /builds/pencillabs/ej/ej-application
- python3 -m venv /tmp/venv && . /tmp/venv/bin/activate && pip install invoke django-environ
- . /tmp/venv/bin/activate && inv docker-build --tag ${CI_COMMIT_SHA} --registry registry.pencillabs.tec.br --no-cache
- . /tmp/venv/bin/activate && inv docker-push --tag ${CI_COMMIT_SHA} --registry registry.pencillabs.tec.br
only:
refs:
- develop
tags:
- k8s
deploy_dev_image:
stage: deploy
image:
name: python:3.9.19-slim-bookworm
pull_policy: if-not-present
before_script:
- apt-get update && apt-get install git curl -y
- curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
script:
- helm version
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/pencillabs/infraestructure/helm-charts.git
- cd helm-charts
- helm upgrade ej-homolog ej -f ej/values-homolog.yaml --set server.image.tag="${CI_COMMIT_SHA}" --install --kubeconfig $K8S_CONFIG
only:
refs:
- develop
tags:
- k8s
e2e:
stage: e2e tests
when: manual
image: cypress/base:18.16.0
before_script:
- apt-get update && apt-get install curl -y
script:
- cd /builds/pencillabs/ej/ej-application/src/ej/tests/e2e
- ./run.sh https://ejplatform.pencillabs.tec.br
tags:
- k8s
only:
refs:
- develop
build_prod_image:
stage: build
image:
name: docker
pull_policy: if-not-present
before_script:
- apk update && apk add git
script:
- git clone -b stable --depth=1 https://$GITLAB_INFRA_TOKEN@gitlab.com/pencillabs/infraestructure/core.git
- cd core
- bin/pencilctl build ej -e prod -b prod -c prod --no-cache --push
only:
refs:
- prod
tags:
- k8s