forked from Dart-Code/Dart-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
195 lines (178 loc) · 7.29 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
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
sudo: false
notifications:
email: false
os:
- osx
- linux
language: node_js
node_js: lts/*
env:
global:
- CC_TEST_REPORTER_ID=f2af8ead3f06fab9ee221478fa43d8ff05a0ac7e0103d91a35b43a0ddb198c94
- FLUTTER_TEST=true
matrix:
- ONLY_RUN_CODE_VERSION=STABLE ONLY_RUN_DART_VERSION=STABLE RUN_TESTS=dart
- ONLY_RUN_CODE_VERSION=DEV ONLY_RUN_DART_VERSION=STABLE RUN_TESTS=dart
- ONLY_RUN_CODE_VERSION=STABLE ONLY_RUN_DART_VERSION=DEV RUN_TESTS=dart
- ONLY_RUN_CODE_VERSION=DEV ONLY_RUN_DART_VERSION=DEV RUN_TESTS=dart
- ONLY_RUN_CODE_VERSION=STABLE ONLY_RUN_DART_VERSION=STABLE RUN_TESTS=flutter
- ONLY_RUN_CODE_VERSION=DEV ONLY_RUN_DART_VERSION=STABLE RUN_TESTS=flutter
- ONLY_RUN_CODE_VERSION=STABLE ONLY_RUN_DART_VERSION=DEV RUN_TESTS=flutter
- ONLY_RUN_CODE_VERSION=DEV ONLY_RUN_DART_VERSION=DEV RUN_TESTS=flutter
matrix:
fast_finish: true
allow_failures:
- env: ONLY_RUN_CODE_VERSION=DEV ONLY_RUN_DART_VERSION=STABLE
- env: ONLY_RUN_CODE_VERSION=STABLE ONLY_RUN_DART_VERSION=DEV
- env: ONLY_RUN_CODE_VERSION=DEV ONLY_RUN_DART_VERSION=DEV
# Don't build tags.
# Don't build Stable/Dev or Dev/Stable unless master (and not a PR->master merge build)
# as the changes of a failure showing up in those and not in either Stable/Stable or
# Dev/Dev are pretty slim so this will half the time for branch builds.
if: tag IS blank AND ((branch = master and type = push) OR (env(ONLY_RUN_DART_VERSION) = env(ONLY_RUN_CODE_VERSION)))
cache:
directories:
- $HOME/.pub-cache
- $HOME/.npm
- with\ spaces/flutter
addons:
chrome: stable
apt:
packages:
- libsecret-1-dev
- libstdc++6
- gcc-4.8
services:
- xvfb
before_install:
- echo Misc setup
- export ELECTRON_NO_ATTACH_CONSOLE=1
- export TRAVIS_COMMIT_AUTHOR="$(git log -1 $TRAVIS_COMMIT --pretty="%aN")"
- gem install dpl
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then
export DART_OS=macos;
else
export DART_OS=linux;
fi
- echo Setting variables...
- if [[ $ONLY_RUN_DART_VERSION == "STABLE" ]]; then
export DART_CHANNEL=stable/release;
export FLUTTER_BRANCH=stable;
elif [[ $ONLY_RUN_DART_VERSION == "DEV" ]]; then
export DART_CHANNEL=dev/release;
export FLUTTER_BRANCH=dev;
else
export DART_CHANNEL=be/raw;
export FLUTTER_BRANCH=master;
fi
- mkdir -p with\ spaces
- cd with\ spaces
- echo Downloading Dart and Flutter...
- curl https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/latest/sdk/dartsdk-$DART_OS-x64-release.zip > dart-sdk.zip
- unzip dart-sdk.zip > /dev/null
- export DART_PATH=`pwd`/dart-sdk
- if [[ $RUN_TESTS == "flutter" ]]; then
mkdir -p flutter;
cd flutter;
if [[ ! -d .git ]]; then
git init;
git remote add origin https://github.com/flutter/flutter.git;
else
git remote set-url origin https://github.com/flutter/flutter.git;
fi;
git fetch;
git reset --hard origin/$FLUTTER_BRANCH;
git checkout $FLUTTER_BRANCH --;
cd ..;
echo Configuring Dart and Flutter...
flutter/bin/flutter config --no-analytics;
flutter/bin/flutter update-packages;
if [[ $ONLY_RUN_DART_VERSION != "STABLE" ]]; then
flutter/bin/flutter config --enable-web;
fi;
export FLUTTER_PATH=`pwd`/flutter;
fi;
# To ensure we follow symlinks properly, put links
# in folders that we'll use in PATHs.
- mkdir dartsymlinkbins
- ln -s ../dart-sdk/bin/dart dartsymlinkbins/dart
- if [[ $RUN_TESTS == "flutter" ]]; then
mkdir fluttersymlinkbins;
ln -s ../flutter/bin/flutter fluttersymlinkbins/flutter;
fi;
# To ensure we detectonly detect real SDKs and not non-Dartlang
# dart binaries, add a fake dart that is actually just echo
- mkdir fakedart
- ln -s /bin/echo fakedart/dart
- export DART_PATH_SYMLINK=`pwd`/fakedart:`pwd`/dartsymlinkbins
- export FLUTTER_PATH_SYMLINK=`pwd`/fluttersymlinkbins
- node --version
- npm --version
- dart-sdk/bin/dart --version
- dartsymlinkbins/dart --version
- if [[ $RUN_TESTS == "flutter" ]]; then
flutter/bin/flutter --version;
fluttersymlinkbins/flutter --version;
flutter/bin/flutter doctor;
fi;
- dart-sdk/bin/pub global activate --no-executables stagehand
- dart-sdk/bin/pub global activate --no-executables args 1.5.0
- dart-sdk/bin/pub global activate --no-executables meta 1.1.6
- dart-sdk/bin/pub global activate --no-executables pedantic 1.4.0
- dart-sdk/bin/pub global activate --no-executables json_annotation 1.2.0
- dart-sdk/bin/pub global activate --no-executables devtools
- dart-sdk/bin/pub global activate --no-executables webdev
# These shouldn't be activated, but might be in the pub cache that CI restored
- dart-sdk/bin/pub global deactivate path || true
- dart-sdk/bin/pub global deactivate usage || true
- cd ..
- mkdir -p .test_results
- mkdir -p .dart_code_test_logs
install:
- npm ci
before_script:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
else
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter;
fi
- chmod +x ./cc-test-reporter;
- ./cc-test-reporter before-build;
script:
- npm run lint
- npm test
# flutter_tester processes are leaked by tests that terminate early:
# https://github.com/Dart-Code/Dart-Code/issues/1175
# This doesn't affect end users (since normally we're not spawning their device) so we
# just kill them all and then to a check for remaining Dart processes (we still want
# to ensure we're not leaking anything else).
- killall flutter_tester || true
- ps -ax | grep -v grep | grep dart || true
- if [[ $(pgrep -x dart) ]]; then
echo 'DART WAS FOUND';
travis_result 1;
fi;
- # TODO: Add to Windows
- cp -v $TMPDIR/exthost-*.cpuprofile .dart_code_test_logs || true
- cp -v /tmp/exthost-*.cpuprofile .dart_code_test_logs || true
# TODO: Re-enable this when it's not firing frequently.
# - |
# function exists {
# test -e "$1"
# }
# if exists .dart_code_test_logs/*.cpuprofile; then
# echo 'CPU PROFILES WERE FOUND';
# travis_result 1;
# fi
after_script:
- if [ $TRAVIS_PULL_REQUEST == "false" ]; then
dpl --provider=s3 --bucket="test-results.dartcode.org" --skip_cleanup=true --local-dir=".test_results" --upload-dir="$TRAVIS_BRANCH/$TRAVIS_COMMIT/$TRAVIS_OS_NAME" --acl=public_read --default_text_charset=utf-8;
dpl --provider=s3 --bucket="test-results.dartcode.org" --skip_cleanup=true --local-dir=".dart_code_test_logs" --upload-dir="logs/$TRAVIS_BRANCH/$TRAVIS_COMMIT/$TRAVIS_OS_NAME" --acl=public_read --default_text_charset=utf-8;
fi
- if [ $ONLY_RUN_CODE_VERSION == "STABLE" ] && [ $ONLY_RUN_DART_VERSION == "STABLE" ]; then
./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT;
fi
- |
if [ $TRAVIS_TEST_RESULT != "0" ] && [ $TRAVIS_PULL_REQUEST == "false" ] && [ $TRAVIS_BRANCH == "master" ] && [ $ONLY_RUN_CODE_VERSION == "STABLE" ] && [ $ONLY_RUN_DART_VERSION == "STABLE" ]; then
curl -H "Content-Type: application/json" -X POST -d "{\"content\":\"Build failed on $TRAVIS_BRANCH ($TRAVIS_OS_NAME): $TRAVIS_BUILD_WEB_URL\"}" $DISCORD_WEBHOOK;
fi