-
Notifications
You must be signed in to change notification settings - Fork 183
/
.travis.yml
executable file
·128 lines (112 loc) · 6.42 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
language: node_js
node_js: 12 # Note: windows requires 10 or higher
dist: bionic # Note: dist>=xenial required by microk8s
cache: false # as of 20190709 trav-ci.org started loading garbage from the build cache
services:
- docker
env:
global:
- NYC=true # we want code coverage stats
- WEBPACK_CLIENT_URL="http://localhost:9080/"
- RUNNING_KUI_TEST=true
- KUI_USE_HTTP=true
- CSP_ALLOWED_HOSTS="http://localhost:8081 ws://localhost:8081 http://localhost:9953 ws://localhost:9080 http://localhost:9080 ws://localhost:9081 http://localhost:9081 ws://localhost:9082 http://localhost:9082 ws://localhost:9084 http://localhost:9084"
- PATH=bin:$PATH
- TRAVIS_KUBE_SERVER_VERSION=17
- TRAVIS_KUBE_VERSION=1.18.3
- TRAVIS_HELM_VERSION=3.3.4
- TRAVIS_OC_VERISON=4.3.3
- WINDOW_WIDTH=1400 # ! important ! so that clicks don't fail due to elements being off-viewport
- WINDOW_HEIGHT=1050 # ! ibid !
- BUILD_ENV=production # used in dist/electron/build.sh with npm prune --production
- MOCHA_RUN_TARGET=electron # to save some verbosity below, use this as the default; it will be adjusted to "webpack" as needed
- NO_OPT=true # we don't need any webpack bundle optimizations while running tests
- NO_INSTALLER=true # we don't need to bother building electron package tarballs or DMGs
before_script:
- export DISPLAY=:1; Xvfb $DISPLAY -screen 0 ${WINDOW_WIDTH}x${WINDOW_HEIGHT}x24 $DISPLAY -ac > /dev/null &
- export DISPLAY=:2; Xvfb $DISPLAY -screen 0 ${WINDOW_WIDTH}x${WINDOW_HEIGHT}x24 $DISPLAY -ac > /dev/null &
- export DISPLAY=:3; Xvfb $DISPLAY -screen 0 ${WINDOW_WIDTH}x${WINDOW_HEIGHT}x24 $DISPLAY -ac > /dev/null &
- export DISPLAY=:4; Xvfb $DISPLAY -screen 0 ${WINDOW_WIDTH}x${WINDOW_HEIGHT}x24 $DISPLAY -ac > /dev/null &
- export DISPLAY=:5; Xvfb $DISPLAY -screen 0 ${WINDOW_WIDTH}x${WINDOW_HEIGHT}x24 $DISPLAY -ac > /dev/null &
- ${TRAVIS_BUILD_DIR}/tools/travis/cleanupNvm.sh
# upload codecov (disabled)
# after_script: if [ -n "$NYC" ]; then cd "${TRAVIS_BUILD_DIR}" && ./tools/codecov/report.sh; fi
# default install script
install:
# see https://github.com/IBM/kui/issues/5608
- ./tools/travis/check-error-handlers.sh
- if [ -n "$NEEDS_K8S" ]; then ./tools/travis/microk8s.sh & k8s=$!; fi
- npm ci
- if [ -n "$CLIENT" ] && [ "$CLIENT" != "default" ]; then ./bin/switch-client.sh ${CLIENT-default}; fi
- ./tools/codecov/instrument.sh
- if [ "$MOCHA_RUN_TARGET" = "webpack" ]; then export KUI_USE_PROXY=true; if [ "$DEPLOY" = "cluster" ]; then npx kui-build-webpack && npx kui-build-docker-with-proxy && (kui-run-cproxy &); else npm run watch:webpack; fi; elif [ -z "$TEST_FROM_BUILD" ]; then npm run watch:electron; else npm run build:electron:$TRAVIS_OS_NAME:${TRAVIS_CPU_ARCH-amd64}; fi
- if [ -n "$ow" ]; then wait $ow; fi
- if [ -n "$k8s" ]; then wait $k8s; fi
- if [ -n "$minio" ]; then wait $minio; fi
script:
- npm run test $LAYERS
jobs:
allow_failures:
- if: os = windows AND env(NO_WINDOWS) IS present
include:
#
# Basic arm64 tests
#
#- arch: arm64
# env: LAYERS=core
#
# Kubernetes Tests, using an electron-based client
#
- env: N="k8s electron" NEEDS_K8S=true NEEDS_OC=true NEEDS_TOP=true MOCHA_RUN_TARGET=electron TEST_FROM_BUILD="${TRAVIS_BUILD_DIR}/dist/electron/Kui-linux-x64/Kui" KUI_DIST_PATH=${TEST_FROM_BUILD} NEEDS_HELM=true
script:
- concurrently -n K8S 'npm run test1 k8s k8s-popup'
- concurrently -n K8S1,LOGS,HELM 'npm run test1 k8s1' 'npm run test2 logs' 'npm run test3 helm'
#
# Kubernetes Tests, using a browser-based client
#
- env: N="k8s browser" NEEDS_K8S=true NEEDS_OC=true NEEDS_TOP=true MOCHA_RUN_TARGET=webpack
script:
- concurrently -n K8S3,K8S4 'npm run test1 k8s3' 'npm run test2 k8s4'
- concurrently -n K8S2 'npm run test1 k8s2'
#
# Kubernetes Tests, using a browser-based client, test kubectl CLI
#
- env: N="k8s2-chaos browser" TRAVIS_CHAOS_TESTING=true NEEDS_K8S=true NEEDS_OC=true NEEDS_TOP=true MOCHA_RUN_TARGET=webpack
script:
- concurrently -n K8S2 'npm run test1 k8s2'
#
# General Tests on macOS using an electron client
# !! WARNING: do not execute layers concurrently on mac. Due to the
# !! lack of Xvfb separation, for one, copy/paste in parallel does
# !! not work.
#
- os: osx
env: N="core mac" CLIENT="default" TEST_FROM_BUILD=`[ "$TRAVIS_OS_NAME" = linux ] && echo "${TRAVIS_BUILD_DIR}/dist/electron/Kui-linux-x64/Kui" || echo "${TRAVIS_BUILD_DIR}/dist/electron/Kui-darwin-x64/Kui.app/Contents/MacOS/Kui"` HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
before_install: which jq || brew install jq
script:
- concurrently -n COPY 'npm run test1 core-standalone' # tests that use the Clipboard
- concurrently -n CORE,EDIT,SUP1,SUP2 'npm run test1 core' 'npm run test2 core-support' 'npm run test3 editor' 'npm run test4 core-support2'
#
# General Tests on Linux using a browser-based client
#
- env: N="core bash browser" CLIENT="default" MOCHA_RUN_TARGET="webpack" KUI_USE_PROXY="true"
script: concurrently -n CORE,SUP1,EDIT,SUP2,BASH 'npm run test1 core' 'npm run test2 core-support' 'npm run test3 editor' 'npm run test4 core-support2' 'npm run test5 bash-like'
#
# Bash/PTY tests on Linux using an electron client
#
- env: N="bash electron" CLIENT="default" TEST_FROM_BUILD="${TRAVIS_BUILD_DIR}/dist/electron/Kui-linux-x64/Kui"
script: npm run test1 bash-like-wait && npm run test1 bash-like
#
# API and Bash/PTY tests on Linux using a browser-based client
# we sneak in the bottom input (plugin-client-alternate) in here to speed up travis builds
#
- env: N="api browser" CLIENT="test" MOCHA_RUN_TARGET="webpack"
script:
- TEST_ROOT=packages/test TEST_SUITE_ROOT=node_modules/@kui-shell NYC_INSTRUMENTATION_DONE=true npm run compile
- concurrently -n API1,API2 'npm run test1 api1' 'npm run test2 api2'
- ./bin/switch-client.sh alternate >& /tmp/alt-switch.out
- npm run kill || true; npm run kill:proxy || true
- npm run watch:$MOCHA_RUN_TARGET >& /tmp/alt-watch.out
- BOTTOM_INPUT_MODE=true concurrently -n BOTTOM 'npm run test bottom-input'
- env: N="API" CLIENT="test" MOCHA_RUN_TARGET="electron"
script: npm run test api-popup && concurrently -n API1,API2 'npm run test1 api1' 'npm run test2 api2'