-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
119 lines (109 loc) · 3.67 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
stages:
- client
- server
jobs:
include:
- stage: client
language: android
os: linux
sudo: true
android:
components:
- tools
- platform-tools
- tools
- build-tools-26.0.2
- android-26
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
addons:
apt:
packages:
- oracle-java8-installer
- oracle-java8-set-default
- npm
- jq
before_install:
- export LANG=en_US.UTF-8
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ;
brew install npm ios-sim jq ios-deploy cocoapods ;
rvm use system ;
pod setup ;
fi
- nvm install 8
- npm install -g cordova ionic
- pip install --user awscli
- ./ecr_credentials.sh
- mkdir -p ~/$TRAVIS_BUILD_NUMBER
- aws s3 sync $S3_BUCKET_CACHE/$TRAVIS_BUILD_NUMBER ~/$TRAVIS_BUILD_NUMBER
- mkdir -p ~/requisites
- aws s3 sync $S3_BUCKET_REQUISITES ~/requisites
script:
# install build dependecies
- cd $TRAVIS_BUILD_DIR/client/mobile-ticket-queue
- npm install
# - install plugins etc.
- ionic cordova plugin add https://github.com/EddyVerbruggen/Custom-URL-scheme.git --variable URL_SCHEME=mobileticket
- cordova prepare
# build Android and iOS packages
- ionic build --prod
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ionic cordova build ios --prod --device --release ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
ionic cordova build android --prod --release ;
cp $TRAVIS_BUILD_DIR/client/mobile-ticket-queue/platforms/android/build/outputs/apk/release/android-release.apk
$TRAVIS_BUILD_DIR/outputs/client/release/mbq-release.apk ;
fi
- cp -R -f ./www ~/$TRAVIS_BUILD_NUMBER/
- rm -rf ~/requisites
after_success:
- aws s3 sync ~/$TRAVIS_BUILD_NUMBER $S3_BUCKET_CACHE/$TRAVIS_BUILD_NUMBER
- stage: server
language: scala
os: linux
before_install:
- pip install --user awscli
- ./ecr_credentials.sh
- mkdir -p ~/$TRAVIS_BUILD_NUMBER
- aws s3 sync $S3_BUCKET_CACHE/$TRAVIS_BUILD_NUMBER ~/$TRAVIS_BUILD_NUMBER
script:
- cd $TRAVIS_BUILD_DIR
- cp -R -f ~/$TRAVIS_BUILD_NUMBER/www/* $TRAVIS_BUILD_DIR/src/main/resources/app
- sbt assembly
- cp -f $TRAVIS_BUILD_DIR/target/scala*/*.jar $TRAVIS_BUILD_DIR/outputs/server/release
after_success:
- aws s3 rm --recursive $S3_BUCKET_CACHE/$TRAVIS_BUILD_NUMBER # clean up after ourselves
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -rf $HOME/.gradle/caches/transforms*/
- rm -rf $HOME/.gradle/caches/3.5/fileHashes/
- rm -rf $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
before_script:
# update npm and cordova dependencies
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./travis/addkeys.sh ; fi
- mkdir -p $TRAVIS_BUILD_DIR/outputs/client/release
- mkdir -p $TRAVIS_BUILD_DIR/outputs/server/release
env:
global:
- JAVA_HOME=/usr/lib/jvm/java-8-oracle
# include $HOME/.local/bin for `aws`
- PATH=$HOME/.local/bin:$PATH
- S3_BUCKET_CACHE=s3://rs-travis/mobile-ticket-queue/build-cache
- S3_BUCKET_REQUISITES=s3://rs-travis/mobile-ticket-queue/requisites
deploy:
# deploy build to s3
# s3-eu-west-1.amazonaws.com/rs-travis/mobile-ticket-queue
provider: s3
access_key_id: $aws_user
secret_access_key: $aws_accesskey
region: "eu-west-1"
bucket: "rs-travis"
local_dir: $TRAVIS_BUILD_DIR/outputs
upload_dir: mobile-ticket-queue
skip_cleanup: true
on:
branch: master