Newer
Older
defaults: &defaults
working_directory: ~/repo
version: 2
jobs:
lint-testunit:
<<: *defaults
docker:
- image: circleci/node:8
environment:
CODECOV_TOKEN: caa771ab-3d45-4756-8e2a-e1f25996fef6
steps:
- checkout
- run:
name: Install NPM modules
command: |
npm install
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
- run:
name: Lint
command: |
npm run lint
- run:
name: Test
command: |
npm test
- run:
name: Codecov
command: |
npx codecov
android-build:
<<: *defaults
docker:
- image: circleci/android:api-26-alpha
environment:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"
JVM_OPTS: -Xmx2048m
TERM: dumb
BASH_ENV: "~/.nvm/nvm.sh"
steps:
- checkout
- run:
name: Install Node 8
command: |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
source ~/.nvm/nvm.sh
nvm install 8
- restore_cache:
key: node-modules-{{ checksum ".circleci/config.yml" }}-{{ checksum "package.json" }}
- run:
name: Install NPM modules
command: |
npm install
- restore_cache:
key: android-{{ checksum ".circleci/config.yml" }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
- run:
command: |
cd android
echo $KEYSTORE_BASE64 | base64 --decode > ./app/$KEYSTORE
echo -e "KEYSTORE=$KEYSTORE" > ./gradle.properties
echo -e "KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD" >> ./gradle.properties
echo -e "KEY_ALIAS=$KEY_ALIAS" >> ./gradle.properties
echo -e "KEY_PASSWORD=$KEYSTORE_PASSWORD" >> ./gradle.properties
echo -e "VERSIONCODE=$CIRCLE_BUILD_NUM" >> ./gradle.properties
- run:
name: Install Android Depedencies
command: |
cd android
./gradlew androidDependencies
- run:
name: Build Android App
command: |
cd android
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
./gradlew assembleRelease
mkdir -p /tmp/build
mv app/build/outputs /tmp/build/
- store_artifacts:
path: /tmp/build/outputs
- save_cache:
key: node-modules-{{ checksum ".circleci/config.yml" }}-{{ checksum "package.json" }}
paths:
- ./node_modules
- save_cache:
key: android-{{ checksum ".circleci/config.yml" }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
paths:
- ~/.gradle
ios-build:
macos:
xcode: "8.3.3"
environment:
BASH_ENV: "~/.nvm/nvm.sh"
steps:
- checkout
- run:
name: Install Node 8
command: |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
source ~/.nvm/nvm.sh
# https://github.com/creationix/nvm/issues/1394
set +e
nvm install 8
- run:
name: Update Fastlane
command: |
brew update
brew install ruby
sudo gem install fastlane
- run:
name: Install NPM modules
command: |
- run:
name: Fix known build error
command: |
# Fix error https://github.com/facebook/react-native/issues/14382
cd node_modules/react-native/scripts/
curl https://raw.githubusercontent.com/facebook/react-native/5c53f89dd86160301feee024bce4ce0c89e8c187/scripts/ios-configure-glog.sh > ios-configure-glog.sh
chmod +x ios-configure-glog.sh
- run:
name: Fastlane Build
no_output_timeout: 1200
command: |
cd ios
agvtool new-version -all $CIRCLE_BUILD_NUM
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
fastlane ios build
- store_artifacts:
path: ios/RocketChatRN.ipa
- persist_to_workspace:
root: ios
paths:
- RocketChatRN.ipa
ios-testflight:
macos:
xcode: "8.3.3"
steps:
- checkout
- attach_workspace:
at: ios
- run:
name: Update Fastlane
command: |
brew update
brew install ruby
sudo gem install fastlane
- run:
name: Fastlane Tesflight Upload
command: |
cd ios
fastlane pilot upload --changelog "$(sh ../.circleci/changelog.sh)"
workflows:
version: 2
build-and-test:
jobs:
- lint-testunit
- ios-build:
requires:
- lint-testunit
- ios-hold-testflight:
type: approval
requires:
- ios-build
filters:
branches:
only:
- develop
- master
- ios-testflight:
requires:
- ios-hold-testflight
- android-build:
requires:
- lint-testunit