]>
Commit | Line | Data |
---|---|---|
1 | .only-default: &only-default | |
2 | only: | |
3 | - branches | |
4 | - merge_requests | |
5 | - tags | |
6 | - refs | |
7 | ||
8 | image: node:14 | |
9 | ||
10 | variables: | |
11 | SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache | |
12 | ||
13 | stages: | |
14 | - lint | |
15 | - test | |
16 | - quality | |
17 | ||
18 | before_script: | |
19 | - npm install | |
20 | ||
21 | cache: | |
22 | key: ${CI_COMMIT_REF_SLUG} | |
23 | paths: | |
24 | - node_modules/ | |
25 | - .nyc_output/ | |
26 | - .sonar/cache | |
27 | ||
28 | lint: | |
29 | <<: *only-default | |
30 | stage: lint | |
31 | script: | |
32 | - npm run lint | |
33 | ||
34 | test: | |
35 | <<: *only-default | |
36 | stage: test | |
37 | script: | |
38 | - npm test | |
39 | ||
40 | quality: | |
41 | stage: quality | |
42 | needs: | |
43 | - test | |
44 | image: | |
45 | name: sonarsource/sonar-scanner-cli:latest | |
46 | entrypoint: [""] | |
47 | script: | |
48 | - npm run coverage | |
49 | - sonar-scanner | |
50 | only: | |
51 | - merge_requests | |
52 | - master |