-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
187 lines (179 loc) · 5.01 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
.default_rules:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH =~ /release-*/
- if: $CI_COMMIT_BRANCH =~ /hotfix-*/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- changes:
- .gitlab-ci.yml
.python:
image: "python:$PYTHON_VERSION-slim"
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
WORKING_DIRECTORY: script/python
cache:
key:
files:
- $WORKING_DIRECTORY/requirements.txt
prefix: $CI_JOB_NAME
paths:
- .cache/pip
- venv
before_script:
- python --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- cd $WORKING_DIRECTORY
parallel:
matrix:
- PYTHON_VERSION: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
.webserver:
image: "node:$NODE_VERSION-slim"
variables:
WORKING_DIRECTORY: software/node_server
cache:
key:
files:
- $WORKING_DIRECTORY/package-lock.json
prefix: $CI_JOB_NAME
paths:
- $WORKING_DIRECTORY/node_modules
before_script:
- node --version
- cd $WORKING_DIRECTORY
parallel:
matrix:
- NODE_VERSION: ["18", "lts"]
build:image:
stage: .pre
image: docker:20.10.22
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
WORKING_DIRECTORY: software/rocketlogger
services:
- docker:20.10.22-dind
before_script:
- docker info
- cd $WORKING_DIRECTORY
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx build --push --platform linux/arm/v7 --tag $IMAGE_TAG .
rules:
- !reference [.default_rules, rules]
- changes:
- $WORKING_DIRECTORY/Dockerfile
build:software:
image: $CI_REGISTRY_IMAGE:latest
stage: build
variables:
CC: clang
CXX: clang++
WORKING_DIRECTORY: software/rocketlogger
before_script:
- cd $WORKING_DIRECTORY
script:
- meson setup builddir
- ninja --verbose -C builddir
rules:
- !reference [.default_rules, rules]
- changes:
- $WORKING_DIRECTORY/**/*
docs:software:
image: debian:stable
needs: []
variables:
DEBIAN_FRONTEND: noninteractive
WORKING_DIRECTORY: software/rocketlogger
before_script:
- apt-get update && apt-get install --no-install-recommends --no-install-suggests --assume-yes doxygen graphviz
- cd $WORKING_DIRECTORY
script:
- (cat Doxyfile; echo "WARN_AS_ERROR=FAIL_ON_WARNINGS") | doxygen -
rules:
- !reference [.default_rules, rules]
- changes:
- $WORKING_DIRECTORY/**/*
docs:python:
image: "python:3"
needs: []
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
WORKING_DIRECTORY: script/python
cache:
key:
files:
- $WORKING_DIRECTORY/requirements.txt
prefix: $CI_JOB_NAME
paths:
- .cache/pip
- venv
before_script:
- python --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- cd $WORKING_DIRECTORY
script:
# install dependencies
- python -m pip install --upgrade pip
- python -m pip install sphinx
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# build documentation
- sphinx-build -a -W -b html docs/ build/sphinx/html/
rules:
- !reference [.default_rules, rules]
- changes:
- $WORKING_DIRECTORY/**/*
test:webserver:
extends: .webserver
stage: test
needs: []
script:
- npm install
- npm install --save-dev jest-junit
- npm test -- --ci --collectCoverage --coverageDirectory=coverage --reporters=default --reporters=jest-junit
artifacts:
when: always
reports:
junit: $WORKING_DIRECTORY/junit.xml
coverage_report:
coverage_format: cobertura
path: $WORKING_DIRECTORY/coverage/cobertura-coverage.xml
rules:
- !reference [.default_rules, rules]
- changes:
- $WORKING_DIRECTORY/**/*
test:python:
extends: .python
stage: test
needs: []
variables:
MATPLOTLIB_AVAILABLE: "true"
PANDAS_AVAILABLE: "true"
script:
# install dependencies
- python -m pip install --upgrade pip
- python -m pip install flake8 pytest pytest-cov
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# test with pytest, coverage and JUnit XML report
- pytest --cov=rocketlogger --junitxml=report.xml
- coverage xml
artifacts:
when: always
reports:
junit: $WORKING_DIRECTORY/report.xml
coverage_report:
coverage_format: cobertura
path: $WORKING_DIRECTORY/coverage.xml
rules:
- !reference [.default_rules, rules]
- changes:
- $WORKING_DIRECTORY/**/*