forked from valor-software/ngx-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
287 lines (273 loc) · 8.49 KB
/
.travis.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
sudo: false
language: node_js
node_js: "10"
services:
- xvfb
notifications:
email: false
git:
depth: 3
submodules: false
env:
global:
- MOZ_HEADLESS=1
- SAUCE_USERNAME_PR=valorkinpr
- SAUCE_ACCESS_KEY_PR=e0a97bd3-4b74-4408-89bf-cce1b44a8bf1
- BROWSER_PROVIDER_READY_FILE=/tmp/sauce-connect-ready
- LOGS_DIR=/tmp/logs
- CYPRESS_RECORD_KEY=4aa7a1c0-3a4f-444e-b324-6fc305a543a8
- NPM_AUTH_TOKEN_CI_PR=$(./scripts/ci/npm-ci-key.sh)
# test cypress smoke
testSmokeCy: &testSmokeCy
script:
- ng serve --prod &
- $(npm bin)/wait-on http-get://localhost:4200/#
- npm run cy:run:smoke -- --record --parallel --group smoke-tests
# after all tests finish running we need
# to kill all background jobs (like "npm start &")
- kill $(jobs -p) || true
testPostDeploy: &testPostDeploy
script: CYPRESS_baseUrl=$BASE_URL npm run cy:run:all -- --record --parallel --group $GROUP_NAME --ci-build-id PostDeploy-$GROUP_NAME-$TRAVIS_BUILD_ID
stages:
- name: "Publish to ngx-bootstrap-ci"
if: ( branch = development AND type = push ) OR type = pull_request OR tag =~ ^v\d+
- name: Testing
if: ( branch = development AND type = push ) OR type = pull_request OR tag =~ ^v\d+
- name: deploy
if: branch = development AND type = push OR tag =~ ^v\d+
- name: publish
if: tag =~ ^v\d+
- name: "Post deploy testing"
if: branch = development AND type = push OR tag =~ ^v\d+
before_install:
- export NG_CLI_ANALYTICS=ci
- rm -rf node_modules/ngx-bootstrap
- sudo apt-get install libgconf-2-4
- npm install tslint
install:
- npm ci
- if [[ "$NGV" == "latest" ]]; then ./scripts/ci/npm-ng-latest.sh; fi
- if [[ "$NGV" == "next" ]]; then ./scripts/ci/npm-ng-next.sh; fi
- npm i ngx-bootstrap-ci@$TRAVIS_COMMIT
- npm run ci:rename-pkg
- if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then export SAUCE_USERNAME=$SAUCE_USERNAME_PR; export SAUCE_ACCESS_KEY=$SAUCE_ACCESS_KEY_PR; export NPM_AUTH_TOKEN_CI=$NPM_AUTH_TOKEN_CI_PR; fi
jobs:
fast_finish: true
allow_failures:
- env: NGV=next
- name: sauce-tests
- name: "Cypress Applitools Snapshot tests"
include:
# precache npm and apt dependencies
# - stage: precache
# install: npm ci
# script: true
# addons:
# chrome: stable
# apt:
# sources:
# - ubuntu-toolchain-r-test
# # required by node-gyp to build some packages
# packages:
# - g++-4.8
# run in parallel
- stage: "Publish to ngx-bootstrap-ci"
install: true
script:
- npm ci
- npm run build
- npm run ci:update-pkg
- if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then export NPM_AUTH_TOKEN_CI=$NPM_AUTH_TOKEN_CI_PR; fi
- npm config set '//registry.npmjs.org/:_authToken' $NPM_AUTH_TOKEN_CI
- cd dist
- npm publish --tag $TRAVIS_COMMIT
skip_cleanup: true
on:
all_branches: true
- stage: Testing
# lint code
script: npm run lint-src
name: "Lint"
install: true
# test
- script: npm run test-coverage
name: "Test with current Angular version"
after_success: ./node_modules/.bin/codecov
- script: ng test --configuration ivy && tsc -p schematics/tsconfig.json && npm run test:schematics
name: "Test with current Angular version Ivy:enabled"
env: NGV=ivy
- script: ng test && tsc -p schematics/tsconfig.json && npm run test:schematics
name: "Test with latest Angular version"
env: NGV=latest
- script: ng test && tsc -p schematics/tsconfig.json && npm run test:schematics
name: "Test with next Angular version"
env: NGV=next
- script:
name: "Cypress Smoke Tests 1t thread"
<<: *testSmokeCy
- script:
name: "Cypress Smoke Tests 2d thread"
<<: *testSmokeCy
- script: npm run demo.ng-build
name: "Check prod build with current Angular version"
- script: npm run demo.ng-build:ivy
name: "Check prod build with current version Ivy:enabled"
env: NGV=ivy
- script: npm run demo.ng-build
name: "Check prod build with latest Angular version"
env: NGV=latest
- script: npm run demo.ng-build
name: "Check prod build with next Angular version"
env: NGV=next
- script: npm run test-cross
name: sauce-tests
env: SAUCE=true
addons:
sauce_connect:
username: $SAUCE_USERNAME_PR
access_key: $SAUCE_ACCESS_KEY_PR
before_script:
- mkdir -p $LOGS_DIR
after_script:
- cd node_modules/ngx-bootstrap
- npm config set '//registry.npmjs.org/:_authToken' $NPM_AUTH_TOKEN_CI
- if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then npm unpublish --tag $TRAVIS_COMMIT --force; fi
- &surge
stage: deploy
script:
- if [[ "$NGV" == "ivy" ]]; then npm run demo.build:ivy; fi
- if [[ "$NGV" == "latest" || "$NGV" == "next" ]]; then npm run demo.build:latest; fi
- if [[ "$NGV" != "latest" && "$NGV" != "ivy" && "$NGV" != "next" ]]; then npm run demo.build; fi
deploy:
provider: surge
project: ./gh-pages/
domain: ngx-bootstrap.surge.sh
on: development
- <<: *surge
env: NGV=ivy
deploy:
provider: surge
project: ./gh-pages/
domain: ngx-bootstrap-ivy.surge.sh
on: development
- <<: *surge
env: NGV=latest
deploy:
provider: surge
project: ./gh-pages/
domain: ngx-bootstrap-latest.surge.sh
on: development
- <<: *surge
env: NGV=next
deploy:
provider: surge
project: ./gh-pages/
domain: ngx-bootstrap-next.surge.sh
on: development
# deploy to ngx-universal.herokuapp.com/
- stage: deploy
script: npm run build:ssr
before_deploy:
- cd ./demo/dist
deploy:
provider: heroku
api_key: $HEROKU_API_KEY
skip_cleanup: true
app: ngx-universal
on: development
# publish to gh pages and npm
- stage: publish
script: npm run demo.build
after_deploy: npm run flow.github-release
deploy:
provider: pages
local_dir: gh-pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
app: ngx-universal
on:
tags: true
- stage: publish
script: npm run build
before_deploy: "cd dist"
deploy:
provider: npm
email: "valorkin@gmail.com"
api_key: $NPM_AUTH_TOKEN
tag: next
skip_cleanup: true
on:
tags: true
# test cypress full for herokuapp
- stage: "post deploy testing"
# name: "Run cypress to check SSR"
# env: URL=https://ngx-universal.herokuapp.com/#
script:
name: "Cypress suit run on SSR 1thread"
env:
- GROUP_NAME=SSR
- BASE_URL=https://ngx-universal.herokuapp.com/#/
<<: *testPostDeploy
- script:
name: "Cypress suit run on SSR 2thread"
env:
- GROUP_NAME=SSR
- BASE_URL=https://ngx-universal.herokuapp.com/#/
<<: *testPostDeploy
- script:
name: "Cypress suit run on SSR 3thread"
env:
- GROUP_NAME=SSR
- BASE_URL=https://ngx-universal.herokuapp.com/#/
<<: *testPostDeploy
# test cypress full for gh-pages
- script:
name: "Cypress with @latest angular 1thread"
env:
- GROUP_NAME=ng-latest
- BASE_URL=http://ngx-bootstrap-latest.surge.sh/#/
<<: *testPostDeploy
- script:
name: "Cypress with @latest angular 2thread"
env:
- GROUP_NAME=ng-latest
- BASE_URL=http://ngx-bootstrap-latest.surge.sh/#/
<<: *testPostDeploy
- script:
name: "Cypress with @latest angular 3thread"
env:
- GROUP_NAME=ng-latest
- BASE_URL=http://ngx-bootstrap-latest.surge.sh/#/
after_script:
- cd node_modules/ngx-bootstrap
- npm config set '//registry.npmjs.org/:_authToken' $NPM_AUTH_TOKEN_CI
- if: branch = development; then npm unpublish --tag $TRAVIS_COMMIT --force; fi
<<: *testPostDeploy
- script:
name: "Cypress on gh-pages after deploy 1thread"
if: tag =~ ^v\d+
env:
- GROUP_NAME=production
- BASE_URL=https://valor-software.com/ngx-bootstrap/#/
<<: *testPostDeploy
- script:
name: "Cypress on gh-pages after deploy 2thread"
if: tag =~ ^v\d+
env:
- GROUP_NAME=production
- BASE_URL=https://valor-software.com/ngx-bootstrap/#/
<<: *testPostDeploy
- script: APPLITOOLS_API_KEY=Nls100t102uNgLhLpblVUdA3tP104MQQS9VUYgHQ5tYOUuIxU110 CYPRESS_baseUrl=https://valor-software.com/ngx-bootstrap/#/ npm run cy:run:snapshot
name: "Cypress Applitools Snapshot tests"
if: tag =~ ^v\d+
after_script:
- cd node_modules/ngx-bootstrap
- npm config set '//registry.npmjs.org/:_authToken' $NPM_AUTH_TOKEN_CI
- npm unpublish --tag $TRAVIS_COMMIT --force
cache:
apt: true
npm: true
directories:
- node_modules
- ~/.npm
- ~/.cache