forked from cozy-labs/cozy-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
111 lines (102 loc) · 3.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
---
dist: trusty
sudo: false
language: node_js
matrix:
fast_finish: true
include:
- os: linux
node_js: 8
env: CXX=g++-4.8
# @TODO macOS build is much slower
- os: osx
node_js: 8
env:
global:
- COZY_DESKTOP_DIR=/tmp/cozy-desktop
- COZY_URL="http://localhost:8080"
- COZY_PASSPHRASE="CozyTest_1"
- GOPATH="$HOME"
- MOCHA_TIMEOUT="240000"
- NODE_ENV=test
- NPM_CONFIG_PROGRESS=false
services:
- docker
cache:
yarn: true
directories:
- /Library/Caches/Homebrew
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
# install cozy stack for integration test
before_install:
# CouchDB 2
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
travis_retry docker run -d -p 5984:5984 --name couch klaemo/couchdb:2.0.0;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
travis_retry brew cask install apache-couchdb;
printf "\n[log]\nlevel = warn\n" >> /Applications/Apache\ CouchDB.app/Contents/Resources/couchdbx-core/etc/local.ini;
(/Applications/Apache\ CouchDB.app/Contents/Resources/couchdbx-core/bin/couchdb &);
fi
- sleep 5
- curl -X PUT http://127.0.0.1:5984/{_users,_replicator,_global_changes}
# Go 1.8
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
travis_retry brew install gimme;
fi
- travis_retry gimme 1.8;
- source ~/.gimme/envs/go1.8.env;
# Cozy stack v3
- travis_retry go get -u github.com/cozy/cozy-stack
- $GOPATH/bin/cozy-stack serve --log-level warning >/dev/null &
- sleep 1
- $GOPATH/bin/cozy-stack instances add --dev --passphrase "$COZY_PASSPHRASE" localhost:8080
- export COZY_CLIENT_ID=$($GOPATH/bin/cozy-stack instances client-oauth localhost:8080 http://localhost/ test github.com/cozy-labs/cozy-desktop)
- export COZY_STACK_TOKEN=$($GOPATH/bin/cozy-stack instances token-oauth localhost:8080 "$COZY_CLIENT_ID" io.cozy.files io.cozy.settings)
# COZY_DESKTOP_DIR
- mkdir -p "$COZY_DESKTOP_DIR"
# Dummy .env.test (all variables are already set)
# env-cmd ignores the file when empty
- echo "NODE_ENV=test" > "${TRAVIS_BUILD_DIR}/.env.test"
before_script:
# Set up display for electron-mocha
- export DISPLAY=:99.0
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
( sudo Xvfb :99 -ac -screen 0 1024x768x8; echo ok )&
else
sh -e /etc/init.d/xvfb start;
fi
- sleep 3 # give xvfb some time to start
script:
- travis_retry yarn
- yarn build
- yarn lint
- yarn test:unit:coverage -- --timeout $MOCHA_TIMEOUT
- yarn test:elm
- yarn test:integration -- --timeout $MOCHA_TIMEOUT
- yarn test:scenarios -- --timeout $MOCHA_TIMEOUT
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker run --rm \
--env-file <(env -u TRAVIS_COMMIT_MESSAGE | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:8 \
/bin/bash -c "yarn dist:all"
else
yarn dist:all
fi
after_success:
- bash <(curl -s https://codecov.io/bash)
after_failure:
- $CXX --version
- netstat -lntp