Debian Codegraph @

.travis.yml

raw symbols SCIP
1 language: node_js
2 node_js:
3 - "0.6"
4 - "0.8"
5 - "0.10"
6 - "0.12"
7 - "1.8"
8 - "2.5"
9 - "3.3"
10 - "4.9"
11 - "5.12"
12 - "6.17"
13 - "7.10"
14 - "8.17"
15 - "9.11"
16 - "10.18"
17 - "11.15"
18 - "12.14"
19 - "13.5"
20 sudo: false
21 dist: trusty
22 env:
23 global:
24 # Suppress Node.js 0.6 compile warnings
25 - "CXXCOM='$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-narrowing -Wno-strict-overflow $_CCCOMCOM $SOURCES'"
26 cache:
27 directories:
28 - node_modules
29 before_install:
30 - |
31 # Setup utility functions
32 function node_version_lt () {
33 [[ "$(v "$TRAVIS_NODE_VERSION")" -lt "$(v "${1}")" ]]
34 }
35 function npm_module_installed () {
36 npm -lsp ls | grep -Fq "$(pwd)/node_modules/${1}:${1}@"
37 }
38 function npm_remove_module_re () {
39 node -e '
40 fs = require("fs");
41 p = JSON.parse(fs.readFileSync("package.json", "utf8"));
42 r = RegExp(process.argv[1]);
43 for (k in p.devDependencies) {
44 if (r.test(k)) delete p.devDependencies[k];
45 }
46 fs.writeFileSync("package.json", JSON.stringify(p, null, 2) + "\n");
47 ' "$@"
48 }
49 function npm_use_module () {
50 node -e '
51 fs = require("fs");
52 p = JSON.parse(fs.readFileSync("package.json", "utf8"));
53 p.devDependencies[process.argv[1]] = process.argv[2];
54 fs.writeFileSync("package.json", JSON.stringify(p, null, 2) + "\n");
55 ' "$@"
56 }
57 function v () {
58 tr '.' '\n' <<< "${1}" \
59 | awk '{ printf "%03d", $0 }' \
60 | sed 's/^0*//'
61 }
62 # Configure npm
63 - |
64 # Skip updating shrinkwrap / lock
65 npm config set shrinkwrap false
66 # Setup Node.js version-specific dependencies
67 - |
68 # Configure eslint for linting
69 if node_version_lt '8.0'; then npm_remove_module_re '^eslint(-|$)'
70 fi
71 - |
72 # Configure mocha for testing
73 if node_version_lt '0.8' ; then npm_use_module 'mocha' '1.21.5'
74 elif node_version_lt '0.10'; then npm_use_module 'mocha' '2.5.3'
75 elif node_version_lt '4.0' ; then npm_use_module 'mocha' '3.5.3'
76 elif node_version_lt '6.0' ; then npm_use_module 'mocha' '5.2.0'
77 elif node_version_lt '8.0' ; then npm_use_module 'mocha' '6.2.2'
78 fi
79 - |
80 # Configure nyc for testing
81 if node_version_lt '0.10'; then npm_remove_module_re '^nyc$'
82 elif node_version_lt '4.0' ; then npm_use_module 'nyc' '10.3.2'
83 elif node_version_lt '6.0' ; then npm_use_module 'nyc' '11.9.0'
84 elif node_version_lt '8.0' ; then npm_use_module 'nyc' '14.1.1'
85 fi # Update Node.js modules
86 - |
87 # Prune & rebuild node_modules
88 if [[ -d node_modules ]]; then
89 npm prune
90 npm rebuild
91 fi
92 before_script:
93 - |
94 # Contents of node_modules
95 npm -s ls ||:
96 script:
97 - |
98 # Run test script
99 if npm_module_installed 'nyc'; then npm run-script test-travis
100 else npm test
101 fi
102 - |
103 # Run linting, if eslint exists
104 if npm_module_installed 'eslint'; then npm run-script lint
105 fi
106 after_script:
107 - |
108 # Upload coverage to coveralls, if exists
109 if [[ -d .nyc_output ]]; then
110 npm install --save-dev coveralls@2
111 nyc report --reporter=text-lcov | coveralls
112 fi