refactor: modularize npm setup using hidden job template and add Chromium dependency for test stage
This commit is contained in:
1 parent
e73b68e8d2
commit
9e99fc5511
1 file changed
+12
-2
+12
-2
@@ -18,22 +18,26 @@ cache:
|
||||
paths:
|
||||
- .npm/
|
||||
|
||||
before_script:
|
||||
- npm ci --cache .npm --prefer-offline
|
||||
.node_setup:
|
||||
before_script:
|
||||
- npm ci --cache .npm --prefer-offline
|
||||
|
||||
# -- Validate Stage --
|
||||
|
||||
lint:
|
||||
extends: .node_setup
|
||||
stage: validate
|
||||
script:
|
||||
- npx eslint "src/**/*.ts"
|
||||
|
||||
prettier:
|
||||
extends: .node_setup
|
||||
stage: validate
|
||||
script:
|
||||
- npx prettier --check "src/**/*.{ts,html,scss,css,json}"
|
||||
|
||||
type-check:
|
||||
extends: .node_setup
|
||||
stage: validate
|
||||
script:
|
||||
- npx tsc --noEmit
|
||||
@@ -42,6 +46,11 @@ type-check:
|
||||
|
||||
test:
|
||||
stage: test
|
||||
before_script:
|
||||
- apt-get update && apt-get install -y chromium
|
||||
- npm ci --cache .npm --prefer-offline
|
||||
variables:
|
||||
CHROME_BIN: /usr/bin/chromium
|
||||
script:
|
||||
- npm run test -- --watch=false --browsers=ChromeHeadless --code-coverage
|
||||
artifacts:
|
||||
@@ -53,6 +62,7 @@ test:
|
||||
# -- Build Stage --
|
||||
|
||||
build:
|
||||
extends: .node_setup
|
||||
stage: build
|
||||
script:
|
||||
- npm run build -- --configuration production
|
||||
|
||||
Reference in new issue
Block a user