-
Notifications
You must be signed in to change notification settings - Fork 2
/
javascript.yml
65 lines (58 loc) · 1.26 KB
/
javascript.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
spec:
inputs:
platform:
description: 'The JavaScript platform to use'
type: string
options:
- 'node'
default: 'node'
version:
description: 'The JavaScript platform version to use'
type: string
default: '18.16.0'
prepare_stage:
description: 'The stage to prepare the node_modules'
type: string
default: 'prepare'
lint_stage:
description: 'The stage to run the linting'
type: string
default: 'lint'
---
.node-cache: &node-cache
key:
files:
- yarn.lock
- package-lock.json
prefix: node-$CI_COMMIT_REF_NAME
paths:
- node_modules
policy: pull
.node:
image: $[[ inputs.platform ]]:$[[ inputs.version ]]
before_script:
cache:
- <<: *node-cache
node_modules:
extends: .node
stage: $[[ inputs.prepare_stage ]]
script:
- yarn install
interruptible: true
retry:
max: 1
cache:
- key: !reference [.node-cache, key]
paths: !reference [.node-cache, paths]
policy: pull-push
rules:
- if: '$NODE_PACKAGE_REQUIRED == "yes"'
yarn-audit:
extends: .node
stage: $[[ inputs.lint_stage ]]
script:
- yarn audit
interruptible: true
allow_failure: true
rules:
- if: '$NODE_PACKAGE_REQUIRED == "yes"'