@@ -6,6 +6,7 @@ variables:
6
6
DOCS_VERSION : development
7
7
MENDER_IMAGE_GUI : ${MENDER_IMAGE_REGISTRY}/${MENDER_IMAGE_REPOSITORY}/gui:${MENDER_IMAGE_TAG}
8
8
FF_TIMESTAMPS : true
9
+ FRONTEND_DIR : ${CI_PROJECT_DIR:-$(git rev-parse --show-toplevel)}/frontend
9
10
10
11
test:frontend:lint :
11
12
stage : test
@@ -18,10 +19,9 @@ test:frontend:lint:
18
19
compare_to : ' ${RULES_CHANGES_COMPARE_TO_REF}'
19
20
needs : []
20
21
script :
21
- - cd frontend
22
- - npm ci --cache .npm --prefer-offline
23
- - cd tests/e2e_tests && npm ci && cd ../..
24
- - npm run lint
22
+ - npm ci --prefix ${FRONTEND_DIR} --cache ${FRONTEND_DIR}/.npm --prefer-offline
23
+ - npm ci --prefix ${FRONTEND_DIR}/tests/e2e_tests
24
+ - npm run lint --prefix ${FRONTEND_DIR}
25
25
tags :
26
26
- k8s
27
27
@@ -38,9 +38,9 @@ test:frontend:license-headers:
38
38
before_script :
39
39
- apt update && apt install git -yq
40
40
script :
41
- - deno task --cwd frontend /scripts licenseCheck --rootDir $(pwd)
42
- - git diff --exit-code frontend /src
43
- - git diff --exit-code frontend /tests
41
+ - deno task --cwd ${FRONTEND_DIR} /scripts licenseCheck --rootDir ${CI_PROJECT_DIR}
42
+ - git diff --exit-code ${FRONTEND_DIR} /src
43
+ - git diff --exit-code ${FRONTEND_DIR} /tests
44
44
45
45
test:frontend:licenses :
46
46
image : ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/denoland/deno:debian-2.0.2
@@ -55,13 +55,12 @@ test:frontend:licenses:
55
55
- job : build:frontend:docker
56
56
artifacts : true
57
57
before_script :
58
- - cd frontend
59
58
- apt-get update && apt-get install -yq curl
60
59
- curl -fsSL https://deb.nodesource.com/setup_23.x | bash
61
60
- apt-get install -yq nodejs
62
- - npm ci
61
+ - npm ci --prefix ${FRONTEND_DIR}
63
62
script :
64
- - deno run --allow-env --allow-read --allow-sys tests/licenses/licenseCheck.ts --rootDir $(pwd)
63
+ - deno run --allow-env --allow-read --allow-sys --config ${FRONTEND_DIR}/scripts/deno.json ${FRONTEND_DIR}/ tests/licenses/licenseCheck.ts --rootDir ${FRONTEND_DIR}
65
64
tags :
66
65
- k8s
67
66
@@ -78,15 +77,14 @@ test:frontend:unit:
78
77
needs : []
79
78
timeout : 10 minutes
80
79
script :
81
- - cd frontend
82
- - npm ci
83
- - npm run test -- --reporter=default --reporter=junit --outputFile.junit=./junit.xml --coverage
80
+ - npm ci --prefix ${FRONTEND_DIR}
81
+ - npm run test --prefix ${FRONTEND_DIR} -- --reporter=default --reporter=junit --outputFile.junit=${FRONTEND_DIR}/junit/junit.xml --coverage
84
82
artifacts :
85
83
expire_in : 2w
86
84
paths :
87
- - frontend /coverage
85
+ - ${FRONTEND_DIR} /coverage
88
86
reports :
89
- junit : frontend /junit.xml
87
+ junit : ${FRONTEND_DIR}/junit /junit.xml
90
88
when : always
91
89
tags :
92
90
- k8s
@@ -103,9 +101,8 @@ test:frontend:docs-links:
103
101
needs : []
104
102
before_script :
105
103
- apk add --no-cache curl
106
- - cd frontend
107
104
script :
108
- - links=$(grep -r docs.mender.io src/ | grep -v snapshots | sed -e 's,\${docsVersion},'${DOCS_VERSION}'/,g' | sed -e 's,\${path},''/,g' | egrep -o 'https?://[^ `"]+' | sort | uniq)
105
+ - links=$(grep -r docs.mender.io ${FRONTEND_DIR}/ src/ | grep -v snapshots | sed -e 's,\${docsVersion},'${DOCS_VERSION}'/,g' | sed -e 's,\${path},''/,g' | egrep -o 'https?://[^ `"]+' | sort | uniq)
109
106
- error=0
110
107
- |
111
108
for url in $links; do
@@ -139,11 +136,13 @@ build:frontend:docker:
139
136
- if : ' $CI_COMMIT_REF_PROTECTED == "true"'
140
137
when : always
141
138
script :
142
- - cd frontend
143
- - if test -z "${DOCKER_PLATFORM}"; then
144
- - docker context create ci;
145
- - fi
146
- - docker buildx create ${DOCKER_BUILDKITARGS} --name gui-builder --driver=docker-container ci
139
+ - |
140
+ if test -z "${DOCKER_PLATFORM}"; then
141
+ docker context create ci;
142
+ fi
143
+ - docker buildx create ${DOCKER_BUILDKITARGS}
144
+ --name gui-builder
145
+ --driver=docker-container ci
147
146
# build production target
148
147
- docker build
149
148
--tag ${MENDER_IMAGE_GUI}
@@ -156,13 +155,15 @@ build:frontend:docker:
156
155
--platform ${DOCKER_PLATFORM:-linux/amd64}
157
156
--provenance false
158
157
--push
159
- .
158
+ ${FRONTEND_DIR}
160
159
- docker context use ci
161
- - docker run --rm --entrypoint "/bin/sh" -v $(pwd):/extract ${MENDER_IMAGE_GUI} -c "cp licenses.json /extract/"
160
+ - docker run --rm --entrypoint "/bin/sh"
161
+ -v ${FRONTEND_DIR}:/extract ${MENDER_IMAGE_GUI}
162
+ -c "cp licenses.json /extract/"
162
163
artifacts :
163
164
expire_in : 1w
164
165
paths :
165
- - frontend /licenses.json
166
+ - ${FRONTEND_DIR} /licenses.json
166
167
167
168
.template:test:frontend:acceptance :
168
169
stage : test
@@ -199,20 +200,20 @@ build:frontend:docker:
199
200
artifacts :
200
201
expire_in : 2w
201
202
paths :
202
- - frontend /coverage
203
- - frontend /screenshots
204
- - frontend /junit
203
+ - ${FRONTEND_DIR} /coverage
204
+ - ${FRONTEND_DIR} /screenshots
205
+ - ${FRONTEND_DIR} /junit
205
206
reports :
206
207
junit :
207
- - frontend /junit/results.xml
208
+ - ${FRONTEND_DIR} /junit/results.xml
208
209
when : always
209
210
tags :
210
211
- hetzner-amd-ax42
211
212
212
213
test:frontend:acceptance :
213
214
extends : .template:test:frontend:acceptance
214
215
script :
215
- - ./frontend /tests/e2e_tests/run
216
+ - ${FRONTEND_DIR} /tests/e2e_tests/run
216
217
217
218
test:frontend:acceptance:enterprise :
218
219
extends : .template:test:frontend:acceptance
@@ -225,7 +226,7 @@ test:frontend:acceptance:enterprise:
225
226
- unset MENDER_IMAGE_REGISTRY MENDER_IMAGE_REPOSITORY
226
227
- export MENDER_IMAGE_TAG=main
227
228
- docker login -u $REGISTRY_MENDER_IO_USERNAME -p $REGISTRY_MENDER_IO_PASSWORD registry.mender.io
228
- - ./frontend /tests/e2e_tests/run --enterprise
229
+ - ${FRONTEND_DIR} /tests/e2e_tests/run --enterprise
229
230
230
231
.template:publish:frontend:tests :
231
232
image : ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/${NODE_IMAGE}
@@ -256,7 +257,7 @@ publish:frontend:tests:
256
257
script :
257
258
- export COVERALLS_SERVICE_JOB_NUMBER=frontend-unit
258
259
- export COVERALLS_FLAG_NAME=frontend-unit
259
- - coveralls < frontend /coverage/lcov.info
260
+ - coveralls < ${FRONTEND_DIR} /coverage/lcov.info
260
261
261
262
publish:frontend:e2e-tests :
262
263
extends : .template:publish:frontend:tests
@@ -275,8 +276,8 @@ publish:frontend:e2e-tests:
275
276
COVERALLS_SERVICE_JOB_NUMBER : frontend-e2e
276
277
COVERALLS_FLAG_NAME : frontend-e2e
277
278
script :
278
- - sed -i -re 's/(^[SF:]+[../]+)(.*)$/SF:\2/' frontend /coverage/lcov.info
279
- - coveralls < frontend /coverage/lcov.info
279
+ - sed -i -re 's/(^[SF:]+[../]+)(.*)$/SF:\2/' ${FRONTEND_DIR} /coverage/lcov.info
280
+ - coveralls < ${FRONTEND_DIR} /coverage/lcov.info
280
281
281
282
publish:frontend:e2e-tests:enterprise :
282
283
extends : publish:frontend:e2e-tests
@@ -346,12 +347,12 @@ publish:frontend:licenses:
346
347
- job : build:frontend:docker
347
348
artifacts : true
348
349
script :
349
- - deno task --cwd frontend /scripts licenseFormatting --rootDir $(pwd)
350
+ - deno task --cwd ${FRONTEND_DIR} /scripts licenseFormatting --rootDir ${CI_PROJECT_DIR}
350
351
artifacts :
351
352
when : on_success
352
353
expire_in : 1w
353
354
paths :
354
- - frontend /licenses.md
355
+ - ${FRONTEND_DIR} /licenses.md
355
356
356
357
publish:frontend:sentry:finalize :
357
358
image : ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/getsentry/sentry-cli
0 commit comments