forked from janus-llm/janus-llm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
201 lines (186 loc) · 3.71 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
image: "python:3.11"
before_script:
- curl -ksSL https://gitlab.mitre.org/mitre-scripts/mitre-pki/raw/master/os_scripts/install_certs.sh | sh
- python --version
- curl -sSkL https://install.python-poetry.org | python -
- export PATH=$PATH:$HOME/.local/bin
- poetry --version
.install_dev:
script:
- poetry install --without docs
stages:
- Static Analysis
- Security
- Documentation
- Release
- Tests
- Dummy
###################
# Static Analysis #
###################
flake8:
stage: Static Analysis
tags:
- docker
script:
- poetry install --only dev
- poetry run flake8 --config=.flake8 .
needs: []
only:
refs:
- merge_requests
changes:
- "**/*.py"
- poetry.lock
- .flake8
black:
stage: Static Analysis
tags:
- docker
script:
- poetry install --only dev
- poetry run black --check --config pyproject.toml ./
needs: []
only:
refs:
- merge_requests
changes:
- "**/*.py"
- poetry.lock
isort:
stage: Static Analysis
tags:
- docker
script:
- poetry install --only dev
- poetry run isort --check --profile black --trailing-comma -m=3 .
needs: []
only:
refs:
- merge_requests
changes:
- "**/*.py"
- poetry.lock
############
# Security #
############
bandit:
stage: Security
tags:
- docker
script:
- poetry install --only dev
- poetry run bandit -r .
needs: []
only:
refs:
- merge_requests
changes:
- "**/*.py"
- poetry.lock
##############
# Unit Tests #
##############
coverage:
stage: Tests
tags:
- docker
variables:
GIT_SSL_NO_VERIFY: '1'
"REQUESTS_CA_BUNDLE": "/etc/ssl/certs/ca-certificates.crt"
"SSL_CERT_FILE": "/etc/ssl/certs/ca-certificates.crt"
"NODE_EXTRA_CA_CERTS": "/etc/ssl/certs/ca-certificates.crt"
script:
- poetry install --with coverage
- poetry run python -m coverage run -m pytest -v -m translate janus
- poetry run python -m coverage report -i
- poetry run python -m coverage xml -i
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
needs: []
timeout: 20m
only:
refs:
- merge_requests
- main
changes:
- "**/*.py"
- poetry.lock
################
# GitLab Pages #
################
.pages:
script:
- poetry install --only docs
- poetry run sphinx-build -d docs/build/doctrees docs/source docs/build/html
- mv docs/build/html public/
test-pages:
stage: Documentation
tags:
- docker
extends: .pages
needs: []
artifacts:
expose_as: 'HTML Documentation'
paths:
- public/
expire_in: 1 week
only:
refs:
- merge_requests
changes:
- "**/*.py"
- docs/**/*
- poetry.lock
- pyproject.toml
- README.md
pages:
stage: Documentation
tags:
- docker
extends: .pages
artifacts:
paths:
- public
only:
- tags
###########################
# Packaging and Releasing #
###########################
test-release:
stage: Release
tags:
- docker
script:
- poetry build
- poetry run pip install -U dist/*.whl
# Remove the directory so that it's not using the directory to run the code and it uses the installed package
- rm -rf janus
- poetry run python tests/package.py
needs: []
only:
refs:
- merge_requests
changes:
- "**/*.py"
- poetry.lock
- pyproject.toml
#########
# Dummy #
#########
dummy-workflow:
stage: Dummy
tags:
- docker
script:
- echo "Dummy CI Job"
needs: []
only:
refs:
- merge_requests
changes:
- .github/workflows/**/*