forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
103 lines (103 loc) · 5.2 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
# -----------------------------------------------------------------------------
#
# REMINDER: If you edit this file, you'll most likely also want to edit
# circle.yml in the kbfs repository!
#
# -----------------------------------------------------------------------------
machine:
xcode:
version: 8.3.3
node:
version: 8
java:
version: oraclejdk8
environment:
GOPATH: $HOME/go-path
PATH: $GOROOT/bin:$PATH
# Limit memory usage of gradle
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1024m -XX:+HeapDumpOnOutOfMemoryError"'
REACT_NATIVE_MAX_WORKERS: 1
# Some node dependencies break without this
CXX: g++-4.8
ANDROID_NDK_HOME: ${ANDROID_NDK}
general:
build_dir: shared
dependencies:
pre:
# - nvm ls-remote
- sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update -qq
# - sudo apt-cache show yarn
- sudo apt-get install -y -qq yarn=1.0.2-1
- sudo rm -rf /usr/local/go* # Remove old go installation
- mkdir -p ~/downloads
- mkdir -p ~/go-path
- ls "$HOME/downloads"
- ls "$ANDROID_HOME"
- if [[ ! -e "$HOME/downloads/go.19.tar.gz" ]]; then wget -nv https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz -O $HOME/downloads/go.19.tar.gz ; fi
- cd $HOME && tar -xzvf downloads/go.19.tar.gz
- sudo mv $HOME/go /usr/local
- if ! $(grep -q "Revision=24.4.1" $ANDROID_HOME/tools/source.properties); then echo y | android update sdk -u -a -t "tools"; fi
- 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
- 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
- mkdir -p /usr/local/android-sdk-linux/licenses
- 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
- echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > /usr/local/android-sdk-linux/licenses/android-sdk-license
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> /usr/local/android-sdk-linux/licenses/android-sdk-license
# Install Yarn
cache_directories:
- ~/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
override:
# TODO(mm): use the emulator when we figure out a consistent way of getting this working
# - emulator -avd circleci-android22 -no-audio -no-window:
# background: true
# parallel: true
- rm -rf ~/client/shared/node_modules
- yarn install --pure-lockfile --ignore-engines --prefer-offline
- yarn global add react-native-cli
- mkdir -p $GOPATH/src/github.com/keybase
- ln -s $HOME/client $GOPATH/src/github.com/keybase/client
- yarn run rn-gobuild-android
- ls -la $GOPATH/src/github.com/keybase/client/shared/react-native/android/keybaselib/keybaselib.aar
test:
pre:
- mkdir -p react-native/android/app/build/intermediates/assets/releaseUnsigned
- mkdir -p react-native/android/app/build/intermediates/res/merged/releaseUnsigned
override:
# TODO(mm) uncomment these device tests (see todo above)
# wait for it to have booted
# - circle-android wait-for-boot
# run tests against the emulator.
# - (cd android && ./gradlew connectedAndroidTest)
# copy the build outputs to artifacts
# - cp -r android/app/build/outputs $CIRCLE_ARTIFACTS
# copy the test results to the test results directory.
# - cp -r android/app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS
# Build a debug version of the app
# Bundle JS separately because doing it in the gradle build is buggy
- 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:
environment:
PATH: $HOME/.yarn/bin:$PATH
# Build app
- ./gradlew assembleReleaseUnsigned -x bundleReleaseUnsignedJsAndAssets:
pwd:
react-native/android
# Upload it to appetize
# And grep so we only reveal the public url in the CI logs
- ./react-native/uploadApp.sh | grep -Eo "\"publicURL\":\"[^\"]*\"|APK_URL:.*$":
environment:
PLATFORM: android
PLATFORM_BUILD_PATH: "react-native/android/app/build/outputs/apk/app-releaseUnsigned.apk"
S3_URL: "s3://kb-appbuilds/"
BUILD_URL: "https://s3-us-west-2.amazonaws.com/kb-appbuilds/"