forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
153 lines (130 loc) · 6.82 KB
/
circle.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
# -----------------------------------------------------------------------------
#
# REMINDER: If you edit this file, you'll most likely also want to edit
# circle.yml in the kbfs repository!
#
# -----------------------------------------------------------------------------
version: 2
jobs:
build:
working_directory: ~/client
parallelism: 1
shell: /bin/bash --login
environment:
GOVERSION: 1.10.3
# Some node dependencies break without this.
CXX: g++-4.8
# TODO: Consider picking a better docker image.
#
# For more information on choosing an image (or alternatively
# using a VM instead of a container) see
# https://circleci.com/docs/2.0/executor-types/ To see the list of
# pre-built images that CircleCI provides for most common
# languages see https://circleci.com/docs/2.0/circleci-images/
docker:
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
command: /sbin/init
steps:
##
## Install prereqs.
##
- run:
name: Update PATH and Define Environment Variables at Runtime
command: |
echo 'export NODE_VERSION=10.7.0' >> $BASH_ENV
echo 'export GOROOT=$HOME/go' >> $BASH_ENV
echo 'export GOPATH=$HOME/go-path' >> $BASH_ENV
# Clear out a bunch of cruft from PATH, including ~/.yarn/bin,
# which has a really old version of yarn that overrides the one
# we install below.
echo 'export PATH=/bin:/usr/bin:/opt/circleci/nodejs/v$NODE_VERSION/bin:$GOROOT/bin' >> $BASH_ENV
# Some node dependencies break without this.
echo 'export ANDROID_NDK=$ANDROID_HOME/ndk-bundle' >> $BASH_ENV
echo 'export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle' >> $BASH_ENV
source $BASH_ENV
# Install node and java.
- run: nvm install $NODE_VERSION && nvm alias default $NODE_VERSION
- run: sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/jdk1.8.0" >> $BASH_ENV
# Restore the dependency cache
- restore_cache:
keys:
# This branch if available
- v1-dep-{{ .Branch }}-
# Default branch if not
- v1-dep-master-
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
- v1-dep-
# - run: nvm ls-remote
- run: sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
- run: echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- run: sudo apt-get update -qq
# - run: sudo apt-cache show yarn
- run: sudo apt-get install -y -qq yarn=1.7.0-1
- run: sudo rm -rf /usr/local/go*
- run: mkdir -p ~/downloads ~/go-path
- run: ls "$HOME/downloads"
- run: ls "$ANDROID_HOME"
- run: if [[ ! -e "$HOME/downloads/go.$GOVERSION.tar.gz" ]]; then wget -nv https://storage.googleapis.com/golang/go$GOVERSION.linux-amd64.tar.gz -O $HOME/downloads/go.$GOVERSION.tar.gz ; fi
- run: cd $HOME && tar -xzvf downloads/go.$GOVERSION.tar.gz
- run: if ! $(grep -q "Revision=24.4.1" $ANDROID_HOME/tools/source.properties); then echo y | android update sdk -u -a -t "tools"; fi
- run: if [ ! -e $ANDROID_HOME/build-tools/23.0.2 ]; then echo y | android update sdk -u -a -t "build-tools-23.0.2"; fi
# Android Support Repository, revision 35 / Local Maven repository for Support Libraries
- run: if [ ! -d "/usr/local/android-sdk-linux/extras/android/m2repository/com/android/support/design/24.1.0" ]; then echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"; fi
# Accept android licenses
- run: mkdir -p /usr/local/android-sdk-linux/licenses
- run: if [[ ! -e "$ANDROID_HOME/ndk-bundle" ]]; then wget -nv http://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip -O android-ndk-r11c-linux-x86_64.zip && unzip -o android-ndk-r11c-linux-x86_64.zip -d "$ANDROID_HOME" && mv "$ANDROID_HOME/android-ndk-r11c" "$ANDROID_HOME/ndk-bundle"; fi
- run: echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > /usr/local/android-sdk-linux/licenses/android-sdk-license
- run: echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> /usr/local/android-sdk-linux/licenses/android-sdk-license
##
## Build.
##
- checkout
# Install JS dependencies.
- run:
working_directory: shared
command: yarn install --pure-lockfile --ignore-engines --prefer-offline
- run:
working_directory: shared
command: yarn global add react-native-cli
- run: mkdir -p $GOPATH/src/github.com/keybase
- run: ln -s $HOME/client $GOPATH/src/github.com/keybase/client
- run:
working_directory: shared
command: yarn run rn-gobuild-android
- run: ls -la $GOPATH/src/github.com/keybase/client/shared/react-native/android/keybaselib/keybaselib.aar
# Build a debug version of the app
# Bundle JS separately because doing it in the gradle build is buggy
- run: mkdir -p shared/react-native/android/app/build/intermediates/{assets,res/merged}/releaseUnsigned
- run:
working_directory: shared
environment:
REACT_NATIVE_MAX_WORKERS: 1
command: yarn run react-native bundle --verbose --platform android --dev false --entry-file index.android.js --bundle-output react-native/android/app/build/intermediates/assets/releaseUnsigned/index.android.bundle --assets-dest react-native/android/app/build/intermediates/res/merged/releaseUnsigned
# Build app
- run:
working_directory: shared/react-native/android
environment:
TERM: dumb
# Limit memory usage of gradle
_JAVA_OPTIONS: -Xms512m -Xmx2048m
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"
command: ./gradlew assembleReleaseUnsigned -x bundleReleaseUnsignedJsAndAssets
# Save dependency cache
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
paths:
- ~/.gradle
- ~/downloads
- ~/.cache/yarn
- /tmp/go-android/bin
- /tmp/go-android/pkg
- /usr/local/android-sdk-linux/tools
- /usr/local/android-sdk-linux/ndk-bundle
- /usr/local/android-sdk-linux/build-tools/23.0.2
- /usr/local/android-sdk-linux/extras/android/m2repository
# TODO: Run device tests (see old versions of this file).
# Only run coverage if there were changes to the shared folder
- run: mkdir -p /tmp/flow-coverage
- run:
working_directory: shared
command: if [ $(git rev-parse HEAD) == $(git log -1 --format=format:%H --full-diff .) ]; then yarn flow-coverage-report -t json -o /tmp/flow-coverage && bash <(curl -s https://codecov.io/bash) -f /tmp/flow-coverage/flow-coverage.json; fi