-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
133 lines (124 loc) · 2.88 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
122
123
124
125
126
127
128
129
130
131
132
133
stages:
- lint
- frontend_build
- backend_build
- test
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- frontend/.npm/
- .cache/pip
eslint:
stage: lint
image: node:latest
needs: []
script:
- node --version
- npm --version
- cd frontend
- npm ci --cache .npm --prefer-offline
- npx eslint --format=junit src > ../eslint.xml
artifacts:
reports:
junit: eslint.xml
pylint:
stage: lint
image: python:latest
needs: []
script:
- apt-get update
- apt-get install -y gcc libldap-common libldap2-dev libsasl2-dev
- cd backend
- pip3 install -r requirements-dev.txt
- pylint --exit-zero --output-format=junit shrunk tests/*.py > pylint.xml
artifacts:
reports:
junit: backend/pylint.xml
mypy:
# stage: lint
when: manual
image: python:latest
needs: []
script:
- cd backend
- pip3 install -r requirements-dev.txt
- mypy --junit-xml=./mypy.xml .
artifacts:
reports:
junit: mypy.xml
flake8:
stage: lint
image: python:latest
needs: []
script:
- cd backend
- pip3 install -r requirements-dev.txt
- flake8 --format=pylint --exit-zero --format=junit-xml shrunk backend/tests > flake8.xml
artifacts:
reports:
junit: backend/flake8.xml
frontend_build:
stage: frontend_build
image: node:20
needs: []
script:
- node --version
- npm --version
- cd frontend
- npm ci --cache .npm --prefer-offline
- npm run build
artifacts:
paths:
- backend/shrunk/static/dist/*
backend_build:
stage: backend_build
image: python:3.6
needs:
- frontend_build
dependencies:
- frontend_build
script:
- cd backend
- bash scripts/install-tailwindcss.sh
- bash scripts/build-tailwindcss.sh
- pip3 install -r requirements-build.txt
- apt-get update
- apt-get install -y libsasl2-dev libldap2-dev libssl-dev
- poetry config virtualenvs.create false
- poetry install
- poetry build
artifacts:
paths:
- backend/dist/shrunk-*.whl
pytest:
stage: test
image: python:3.6
needs:
- backend_build
dependencies:
- backend_build
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip_centos"
CRYPTOGRAPHY_DONT_BUILD_RUST: 1
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .cache/pip_centos
services:
- mongo
script:
- apt-get update
- apt-get install -y libldap2-dev libsasl2-dev
- pip3 install backend/dist/shrunk-*.whl
- export SHRUNK_CONFIG_PATH=$(pwd)/backend/shrunk/ci-test-config.py
- mkdir /usr/share/GeoIP
- cp backend/GeoLite2-City.mmdb /usr/share/GeoIP/GeoLite2-City.mmdb
- cd backend
- pip install pytest
- echo "GOOGLE_SAFE_BROWSING_API = '$GOOGLE_SAFE_BROWSING_API'" >> ./shrunk/ci-test-config.py
- pytest --junitxml=../pytest.xml tests
artifacts:
reports:
junit: pytest.xml