-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
158 lines (148 loc) · 4.12 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# This file is a template, and might need editing before it works on your project.
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:latest
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
- _test/
policy: pull
build:
stage: build
script:
- apt update
- apt install -y libavahi-compat-libdnssd-dev
- npm --color="always" install
- npx tsc
- PACKAGE_PATH=`npm --color="always" pack`
- mv $PACKAGE_PATH node-acp-release.tgz
artifacts:
paths:
- dist
- node-acp-release.tgz
only:
changes:
- .gitlab-ci.yml
- package-lock.json
- tsconfig.json
- src/**/*
- types/**/*
except:
variables:
- $NPM_AUDIT_SCHEDULE_SKIP_BUILD
cache:
paths:
- node_modules/
- _test/
policy: pull-push
test:
stage: test
script:
- apt update
- apt install -y libavahi-compat-libdnssd-dev
- npm install
- npx qunit dist/test/**.js
only:
changes:
- .gitlab-ci.yml
- package-lock.json
- tsconfig.json
- src/**/*
except:
variables:
- $NPM_AUDIT_SCHEDULE_SKIP_BUILD
dependencies:
- build
firmware-test:
stage: test
script:
- apt update
- apt install -y libavahi-compat-libdnssd-dev
- npm install
- PATH=`pwd`/bin:$PATH scripts/test-firmware-115-7.8.1.sh
- PATH=`pwd`/bin:$PATH scripts/test-firmware-120-7.9.1.sh
only:
changes:
- .gitlab-ci.yml
- package-lock.json
- tsconfig.json
- src/lib/firmware.ts
- src/cli/firmware.ts
except:
variables:
- $NPM_AUDIT_SCHEDULE_SKIP_BUILD
dependencies:
- build
cache:
paths:
- node_modules/
- _test/
policy: pull-push
lint:
stage: test
script:
- apt update
- apt install -y libavahi-compat-libdnssd-dev
- npm install
- npx eslint --color src/**/*.ts types/**/*.d.ts
only:
changes:
- .gitlab-ci.yml
- package-lock.json
- .eslintrc.js
- src/**/*.ts
- types/**/*.d.ts
except:
variables:
- $NPM_AUDIT_SCHEDULE_SKIP_BUILD
dependencies:
- build
audit:
stage: test
script:
- npm audit --json > npm-audit.json || true
- npm --color="always" audit
artifacts:
paths:
- npm-audit.json
when: always
only:
changes:
- .gitlab-ci.yml
- package-lock.json
dependencies: []
when: always
allow_failure: true
publish-npm:
stage: deploy
script:
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
- npm --color="always" publish
dependencies:
- build
only:
refs:
- /^v.*$/
variables:
- $NPM_TOKEN
except:
- branches
publish-github:
stage: deploy
script:
# Update the package.json and package-lock.json
- "node -e \"fs.writeFileSync('package.json', JSON.stringify((json => {json.name = '@samuelthomas2774/node-acp'; json.publishConfig = {access: 'public'}; return json;})(JSON.parse(fs.readFileSync('package.json', 'utf-8'))), null, 4) + '\\n', 'utf-8')\""
- "node -e \"fs.writeFileSync('package-lock.json', JSON.stringify((json => {json.name = '@samuelthomas2774/node-acp'; return json;})(JSON.parse(fs.readFileSync('package-lock.json', 'utf-8'))), null, 4) + '\\n', 'utf-8')\""
- echo "//npm.pkg.github.com/:_authToken=${GITHUB_NPM_TOKEN}" > .npmrc
- npm --color="always" --registry=https://npm.pkg.github.com/ publish
dependencies:
- build
only:
refs:
- /^v.*$/
variables:
- $GITHUB_NPM_TOKEN
except:
- branches