/
config.yml
270 lines (239 loc) · 7.6 KB
/
config.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
version: 2
.golang_workspace: &golang_workspace
working_directory: /go/src/github.com/berty/berty
environment:
GOPATH: /go
GOTEST_TIMEOUT: 1m
docker:
- image: circleci/golang:latest
jobs:
lint:
docker:
- image: bertychat/linter:latest
working_directory: /go/src/github.com/berty/berty
environment:
GOPATH: /go
steps:
- checkout
- restore_cache:
keys:
- v1-go-cache
- run:
name: prepare CI
command: |
make _ci_prepare
- run:
name: lint
command: make lint
- save_cache:
key: v1-go-cache
paths:
- "/go/pkg"
docker.build:
docker:
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker
- restore_cache:
keys:
- v1-docker-berty
paths:
- /caches/berty.tar
- run:
name: Load Docker image layer cache
command: |
set +o pipefail
docker load -i /caches/berty.tar | true
- run:
name: Build application Docker image
command: |
docker build --cache-from=berty -t berty .
- run:
name: Run application within Docker
command: |
docker run --rm berty daemon --init-only
- run:
name: Save Docker image layer cache
command: |
mkdir -p /caches
docker save -o /caches/berty.tar berty
- save_cache:
key: v1-docker-berty
paths:
- /caches/berty.tar
core.go.test:
<<: *golang_workspace
steps:
- checkout
- restore_cache:
keys:
- v1-go-cache
- run:
name: prepare CI
command: |
make _ci_prepare
mkdir -p /tmp/test-results
go get github.com/jstemmer/go-junit-report
- run:
name: install openssl 1.0.x
command: |
sudo apt-get update
sudo apt-get install libssl1.0-dev
- run:
name: install core
command: |
cd core
make install
- run:
name: test core
command: |
cd core
TEST_SLEEP_BETWEEN_STEPS=1s make test | tee /tmp/test-results/go-test-report.out
- run:
name: test client (bot)
command: |
cd client/go
go test -v ./... | tee /tmp/test-results/go-test-report.out
go install -v ./...
- run:
name: integration core
command: |
cd core
make integration
- run:
name: junit-report
command: |
go-junit-report < /tmp/test-results/go-test-report.out > /tmp/test-results/go-test-report.xml
- save_cache:
key: v1-go-cache
paths:
- "/go/pkg"
- store_test_results:
path: /tmp/test-results
client.rn.node:
working_directory: ~/go/src/github.com/berty/berty
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: yarn-v1-{{ checksum "client/react-native/yarn.lock" }}-{{ arch }}
- restore_cache:
key: node-v1-{{ checksum "client/react-native/package.json" }}-{{ arch }}
- run: cd client/react-native && make deps
- save_cache:
key: yarn-v1-{{ checksum "client/react-native/yarn.lock" }}-{{ arch }}
paths:
- ~/.cache/yarn
- save_cache:
key: node-v1-{{ checksum "client/react-native/package.json" }}-{{ arch }}
paths:
- node_modules
- persist_to_workspace:
root: ~/go/src/github.com/berty/berty
paths:
- client/react-native/node_modules
- client/react-native/gomobile/node_modules
- client/react-native/common/node_modules
- client/react-native/mobile/node_modules
client.rn.android:
working_directory: ~/go/src/github.com/berty/berty/client/react-native/mobile/android
docker:
- image: sfroment/test:lastest #Fix me when we get berty docker account
steps:
- checkout:
path: ~/go/src/github.com/berty/berty/
- attach_workspace:
at: ~/go/src/github.com/berty/berty/
- run:
name: setup golang environment
command: |
echo "export PATH=/usr/local/go/bin/:~/go/bin:$PATH" >> $BASH_ENV
- run:
name: gomobile android build
command: |
env && cd ../../gomobile && make core.build.android
- restore_cache:
key: android-gems-{{ checksum "~/go/src/github.com/berty/berty/client/react-native/mobile/android/Gemfile.lock" }}
- run:
name: install bundle
command: bundle check || bundle install --path vendor/bundle
- save_cache:
key: android-gems-{{ checksum "~/go/src/github.com/berty/berty/client/react-native/mobile/android/Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: build app
command: |
time bundle exec fastlane android beta
client.rn.ios:
working_directory: ~/go/src/github.com/berty/berty
macos:
xcode: "9.0"
environment:
FL_OUTPUT_DIR: output
shell: /bin/bash --login -o pipefail
steps:
- run:
name: set Ruby version
command: echo "ruby-2.4" > ~/.ruby-version
- restore_cache:
key: ios-golang-{{ .Environment.GOVERSION }}-2
- run:
name: install-go
command: |
if [ ! -f ~/go-install/go/bin/go ]; then
cd ~ && git clone https://github.com/udhos/update-golang
cd ~/update-golang && mkdir ~/go-install && sudo DESTINATION=~/go-install ./update-golang.sh
fi
echo "export PATH=~/go-install/go/bin/:~/go/bin:$PATH" >> $BASH_ENV
- run:
name: install gomobile
command: |
if [ ! -f ~/go/bin/gomobile ]; then
go get golang.org/x/mobile/cmd/gomobile
cd ~/go/src/golang.org/x/mobile
git remote add upstream git@github.com:sfroment/mobile
git fetch upstream
git cherry-pick 1b1535a2ec50640fac08cd318cf1d557e198e94d
go install golang.org/x/mobile/cmd/gomobile
gomobile init
fi
- save_cache:
key: ios-golang-{{ .Environment.GOVERSION }}-2
paths:
- ~/go
- ~/go-install
- checkout
- run:
name: install core
working_directory: ~/go/src/github.com/berty/berty/client/react-native/gomobile
command: |
make core.build.ios
# - restore_cache:
# key: ios-gems-{{ checksum "~/go/src/github.com/berty/berty/client/react-native/mobile/ios/Gemfile.lock" }}-1
- run:
working_directory: ~/go/src/github.com/berty/berty/client/react-native/mobile/ios
command: bundle check || bundle install --path vendor/bundle
# - save_cache:
# key: ios-gems-{{ checksum "~/go/src/github.com/berty/berty/client/react-native/mobile/ios/Gemfile.lock" }}-1
# paths:
# - vendor/bundle
- run:
name: build app
working_directory: ~/go/src/github.com/berty/berty/client/react-native/mobile/ios
command: |
time bundle exec fastlane ios adhoc --verbose
workflows:
version: 2
commit:
jobs:
- lint
- core.go.test
- docker.build
- client.rn.node
- client.rn.android:
requires:
- client.rn.node
- client.rn.ios