forked from secvisogram/secvisogram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
102 lines (91 loc) · 3.79 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
# Include/Enable Gitlab SAST
include:
- template: Security/SAST.gitlab-ci.yml
variables:
# The ACE Editor is included as submodule
GIT_SUBMODULE_STRATEGY: recursive
SECURE_LOG_LEVEL: debug
SAST_EXCLUDED_ANALYZERS: nodejs-scan
default:
image: node:lts-slim
cache:
paths:
- .npm
# Validate that the repository contains a package.json and extract a few values from it.
before_script:
- |
if [[ ! -f package.json ]]; then
echo "No package.json found! A package.json file is required to publish a package to GitLab's NPM registry."
echo 'For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#creating-a-project'
exit 1
fi
- NPM_PACKAGE_NAME=$(node -p "require('./package.json').name")
- NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version")
- npm set cache .npm
- npm ci
- apt-get update && apt-get install -q -y git
build:
stage: build
script:
- npm run-script build
eslint:
stage: build
script:
- npx eslint --env-info
- npx eslint --max-warnings 0
test:
# The test uses mocha-electron which requires more OS dependencies
# We reuse a cypress image for convenience:
# https://github.com/cypress-io/cypress-docker-images/tree/master/base
image: cypress/base:14.15.0
stage: test
script:
- npx tsc -v
# Electron dooesn't like to run under root
- npx tsc -b
- chmod 4755 app/node_modules/electron/dist/chrome-sandbox
- apt-get update && apt-get install -q -y xvfb git
- su node -c 'cd app && /usr/bin/xvfb-run node scripts/test.js'
#
#
# Validate that the package name is properly scoped to the project's root namespace.
# For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#package-naming-convention
# validate_package_scope:
# stage: build
# script:
# - |
# if [[ ! $NPM_PACKAGE_NAME =~ ^@$CI_PROJECT_ROOT_NAMESPACE/ ]]; then
# echo "Invalid package scope! Packages must be scoped in the root namespace of the project, e.g. \"@${CI_PROJECT_ROOT_NAMESPACE}/${CI_PROJECT_NAME}\""
# echo 'For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#package-naming-convention'
# exit 1
# fi
# If no .npmrc if included in the repo, generate a temporary one to use during the publish step
# that is configured to publish to GitLab's NPM registry
# create_npmrc:
# stage: build
# script:
# - |
# if [[ ! -f .npmrc ]]; then
# echo 'No .npmrc found! Creating one now. Please review the following link for more information: https://docs.gitlab.com/ee/user/packages/npm_registry/index.html#authenticating-with-a-ci-job-token'
# {
# echo '@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_SERVER_PROTOCOL}://${CI_SERVER_HOST}:${CI_SERVER_PORT}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/'
# echo '//${CI_SERVER_HOST}:${CI_SERVER_PORT}/api/v4/packages/npm/:_authToken=${CI_JOB_TOKEN}'
# echo '//${CI_SERVER_HOST}:${CI_SERVER_PORT}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}'
# } >> .npmrc
# fi
# artifacts:
# paths:
# - .npmrc
# Publish the package. If the version in package.json has not yet been published, it will be
# published to GitLab's NPM registry. If the version already exists, the publish command
# will fail and the existing package will not be updated.
# publish_package:
# stage: deploy
# script:
# - |
# {
# npm publish &&
# echo "Successfully published version ${NPM_PACKAGE_VERSION} of ${NPM_PACKAGE_NAME} to GitLab's NPM registry: ${CI_PROJECT_URL}/-/packages"
# } || {
# echo "No new version of ${NPM_PACKAGE_NAME} published. This is most likely because version ${NPM_PACKAGE_VERSION} already exists in GitLab's NPM registry."
# }