forked from cozy-labs/cozy-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
136 lines (129 loc) · 4.14 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
---
dist: trusty
language: node_js
node_js: 8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-8
- g++-8
- jq
services:
- docker
cache:
yarn: true
directories:
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- $HOME/bin
env:
global:
- COZY_DESKTOP_DIR=/tmp/cozy-desktop
- COZY_URL="http://localhost:8080"
- COZY_PASSPHRASE="cozy"
- COZY_STACK_STORAGE="$HOME/storage"
- GOPATH="$HOME"
# FIXME: Homebrew 1.7.3 fails to install cask apache-couchdb
- HOMEBREW_NO_AUTO_UPDATE=1
- MOCHA_TIMEOUT="240000"
- NO_BREAKPOINTS=1
- NODE_ENV=test
- NPM_CONFIG_PROGRESS=false
- COZY_DESKTOP_HEARTBEAT=1000
before_install: | # install cozy stack for integration test
# CouchDB
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
travis_retry docker run -d -p 5984:5984 --name couch apache/couchdb:2.2;
fi
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
travis_retry brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/master/Casks/apache-couchdb.rb;
printf "\n[log]\nlevel = warn\n" >> /Applications/Apache\ CouchDB.app/Contents/Resources/couchdbx-core/etc/local.ini;
ulimit -S -n 1024;
(/Applications/Apache\ CouchDB.app/Contents/Resources/couchdbx-core/bin/couchdb >couchdb.log 2>&1 &);
fi
sleep 8
curl -X PUT http://127.0.0.1:5984/{_users,_replicator,_global_changes}
# Cozy-stack
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
travis_retry brew install gimme;
travis_retry brew install imagemagick;
fi
if [[ ! -f $GOPATH/bin/cozy-stack ]]; then
travis_retry gimme 1.11;
source ~/.gimme/envs/go1.11.env;
travis_retry go get -u github.com/cozy/cozy-stack;
fi
# Create a local instance and an OAuth client
mkdir -p "$COZY_STACK_STORAGE"
$GOPATH/bin/cozy-stack serve --fs-url "file://$COZY_STACK_STORAGE" --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
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
hdiutil create -megabytes 10 -fs APFS -volname cozy-desktop "$COZY_DESKTOP_DIR";
hdiutil attach "${COZY_DESKTOP_DIR}.dmg" -mountpoint "$COZY_DESKTOP_DIR";
else
mkdir -p "$COZY_DESKTOP_DIR";
fi
# Dummy .env.test (all variables are already set)
# env-cmd ignores the file when empty
echo "NODE_ENV=test" > "${TRAVIS_BUILD_DIR}/.env.test"
after_failure: ./dev/ci/after_failure.sh
branches:
only:
- master
stages:
- test
- name: notify
if: type = pull_request
jobs:
fast_finish: true
include:
- &test_unit
stage: test
script: ./dev/ci/tests.sh
name: unit and integration tests
os: osx
- <<: *test_unit
os: linux
env:
- CC=gcc-8 CXX=g++-8
- &test_scenarios
stage: test
script: ./dev/ci/scenarios.sh
name: real life scenarios
os: osx
- <<: *test_scenarios
os: linux
env:
- CC=gcc-8 CXX=g++-8
- <<: *test_scenarios
os: linux
name: stopped client scenarios
env:
- STOPPED_CLIENT=1
- <<: *test_scenarios
os: osx
name: stopped client scenarios
env:
- STOPPED_CLIENT=1
- &dist
stage: test
script: ./dev/ci/dist.sh
name: artifacts build
os: osx
- <<: *dist
os: linux
env:
- CC=gcc-8 CXX=g++-8
- stage: notify
name: artifacts built
services: false
cache: false
before_install: skip
install: skip
script: ./dev/ci/notify.sh