-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
366 lines (308 loc) · 7.45 KB
/
Copy path.travis.yml
File metadata and controls
366 lines (308 loc) · 7.45 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# Travis CI Configuration for 9th.js
language: node_js
# Test on multiple Node.js versions
node_js:
- '16'
- '18'
- '20'
# Test on multiple operating systems
os:
- linux
- windows
- osx
# Use Ubuntu 20.04 LTS for Linux builds
dist: focal
# Cache dependencies
cache:
directories:
- node_modules
- ~/.npm
# Environment variables
env:
global:
- NODE_ENV=test
- CI=true
# Build matrix exclusions/inclusions
jobs:
include:
# Fast finish - don't wait for allowed failures
- stage: lint
name: "Lint and Format Check"
node_js: '18'
script:
- npm run lint
- npm run format:check
- npm run type-check
after_success: skip
# Core tests
- stage: test
name: "Unit Tests"
node_js: '18'
script:
- npm run test -- tests/unit
- stage: test
name: "Integration Tests"
node_js: '18'
script:
- npm run test -- tests/integration
# Performance tests (only on pull requests and main branch)
- stage: performance
name: "Performance Tests"
node_js: '18'
if: type = pull_request OR branch = main
script:
- npm run test -- tests/performance
after_script:
- mkdir -p performance-results
- cp coverage/*.json performance-results/ || true
# Visual regression tests (only on pull requests and main branch)
- stage: visual
name: "Visual Regression Tests"
node_js: '18'
if: type = pull_request OR branch = main
script:
- npm run test -- tests/visual
after_script:
- mkdir -p visual-results
- cp coverage/*.json visual-results/ || true
# Load tests (only on pull requests and main branch)
- stage: load
name: "Load Tests"
node_js: '18'
if: type = pull_request OR branch = main
script:
- npm run test -- tests/load
after_script:
- mkdir -p load-results
- cp coverage/*.json load-results/ || true
# Cross-platform tests
- stage: cross-platform
name: "Cross-Platform Tests"
os: windows
node_js: '18'
script:
- npm ci
- npm run test:ci
- stage: cross-platform
name: "macOS Tests"
os: osx
node_js: '18'
script:
- npm ci
- npm run test:ci
# Build tests
- stage: build
name: "Build Verification"
node_js: '18'
script:
- npm run build
- npm run analyze
after_success:
- ls -la dist/
# Security audit
- stage: security
name: "Security Audit"
node_js: '18'
script:
- npm audit --audit-level=moderate
- npm outdated | grep -E "^\w+\s+\d+\.\d+\.\d+\s+.*\d+\.\d+\.\d+" || echo "No major version mismatches"
# Documentation build
- stage: docs
name: "Documentation Build"
node_js: '18'
script:
- npm run docs
after_success:
- test -f docs/api/index.html || (echo "Documentation build failed" && exit 1)
# Browser compatibility tests
- stage: browser
name: "Browser Compatibility"
node_js: '18'
addons:
chrome: stable
firefox: latest
script:
- npm install -g npx
- npx playwright install --with-deps
- npm run test:browser
if: type = pull_request
# Bundle size analysis
- stage: bundle
name: "Bundle Size Analysis"
node_js: '18'
script:
- npm run build
- npm run size
if: branch = main OR type = pull_request
# Coverage upload
- stage: coverage
name: "Coverage Upload"
node_js: '18'
script:
- npm run test:coverage
after_success:
- npm install -g codecov
- codecov
allow_failures:
# Allow performance tests to fail without failing the build
- stage: performance
name: "Performance Tests"
# Allow visual tests to fail without failing the build
- stage: visual
name: "Visual Regression Tests"
# Allow load tests to fail without failing the build
- stage: load
name: "Load Tests"
fast_finish: true
# Installation steps
before_install:
# Update npm
- npm install -g npm@latest
install:
- npm ci
# Before script
before_script:
- echo "Running tests on Travis CI"
- node --version
- npm --version
# After success
after_success:
- echo "All tests passed successfully!"
# After failure
after_failure:
- echo "Tests failed. Collecting debug information..."
- ls -la
- cat package.json
# Deploy stages (only on specific branches)
deploy:
# Deploy documentation to GitHub Pages (main branch only)
- provider: pages
skip_cleanup: true
local_dir: docs/api
github_token: $GITHUB_TOKEN
target_branch: gh-pages
on:
branch: main
condition: $TRAVIS_NODE_VERSION = 18
# Deploy to npm (tagged releases only)
- provider: npm
email: $NPM_EMAIL
api_key: $NPM_API_KEY
skip_cleanup: true
on:
tags: true
node_js: '18'
# Deploy to GitHub Releases (tagged releases only)
- provider: releases
api_key: $GITHUB_TOKEN
file_glob: true
file: dist/*
skip_cleanup: true
on:
tags: true
node_js: '18'
# Notifications
notifications:
email:
recipients:
- team@9thjs.com
on_success: change
on_failure: always
# Slack notifications (if configured)
slack:
rooms:
- secure: $SLACK_TOKEN
on_success: change
on_failure: always
# Webhook notifications (if configured)
webhooks:
urls:
- $WEBHOOK_URL
on_success: change
on_failure: always
# Build stages
stages:
- name: lint
if: type = pull_request OR branch = main
- name: test
if: type = pull_request OR branch = main
- name: performance
if: type = pull_request OR branch = main
- name: visual
if: type = pull_request OR branch = main
- name: load
if: type = pull_request OR branch = main
- name: cross-platform
if: type = pull_request OR branch = main
- name: build
if: branch = main
- name: security
if: branch = main
- name: docs
if: branch = main
- name: browser
if: type = pull_request
- name: bundle
if: branch = main OR type = pull_request
- name: coverage
if: branch = main
- name: deploy
if: tag IS present
# Additional settings
addons:
# Chrome for browser testing
chrome: stable
# Firefox for browser testing
firefox: latest
# Safari for macOS testing
safari:
enabled: true
# Build timeout
timeout: 3600
# Retry flaky tests
cache_retry:
toolcache: true
npm: true
# Environment-specific settings
matrix:
# Fast finish
fast_finish: true
# Allow some jobs to fail without failing the entire build
allow_failures:
- env: BROWSER_TEST=true
- stage: performance
- stage: visual
- stage: load
# Exclude certain combinations
exclude:
# Skip some combinations to reduce build time
- os: osx
node_js: '16'
- os: windows
node_js: '16'
# Custom commands
before_deploy:
- echo "Preparing for deployment..."
- npm run build
- npm run docs
after_deploy:
- echo "Deployment completed!"
# Cleanup
after_script:
- echo "Cleaning up..."
- rm -rf node_modules
- rm -rf ~/.npm
# Debug mode (enable with TRAVIS_DEBUG=true)
debug:
enabled: false
stages:
- name: debug
if: $TRAVIS_DEBUG = true
script:
- echo "Debug mode enabled"
- whoami
- pwd
- env
- node --version
- npm --version
- npm ls