Skip to content

Commit 1a6a140

Browse files
author
Tim Moreton
committed
Initial commit. Hello World
0 parents  commit 1a6a140

File tree

2,144 files changed

+198346
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,144 files changed

+198346
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["react-native"]
3+
}

.circleci/config.yml

Lines changed: 331 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,331 @@
1+
# adapted from https://github.com/CircleCI-Public/circleci-demo-react-native
2+
# and https://github.com/facebook/react-native/blob/master/.circleci/config.yml
3+
4+
version: 2
5+
6+
defaults: &defaults
7+
working_directory: ~/app
8+
docker:
9+
- image: celohq/node8:gcloud-deps
10+
11+
android-defaults: &android-defaults
12+
<<: *defaults
13+
docker:
14+
- image: circleci/android:api-28-node8-alpha
15+
environment:
16+
_JAVA_OPTIONS: '-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap'
17+
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx1024m -XX:+HeapDumpOnOutOfMemoryError"'
18+
19+
general:
20+
artifacts:
21+
- 'mobile/coverage'
22+
- 'protocol/coverage'
23+
24+
jobs:
25+
install_dependencies:
26+
<<: *defaults
27+
steps:
28+
# The standard Circle CI checkout steps makes a shallow clone with the depth of 1
29+
# Which means we have no way of knowing which commits are specifically in this branch.
30+
# We need that for incremental testing.
31+
# This checkout assumes that a single branch will not have more than a certain number commits
32+
# on top of master and if it does, then the incremental testing script will fail. The committer can
33+
# than squash those commits. Which is OK since we squash commits on merge to master
34+
# anyways.
35+
- run:
36+
name: Checkout (with last 100 commits)
37+
command: |
38+
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
39+
git clone --depth 100 --no-single-branch --branch ${CIRCLE_BRANCH} [email protected]:celo-org/celo-monorepo.git ~/app
40+
cd ~/app
41+
set -v
42+
# To get the "master" branch mapping
43+
git checkout master
44+
git checkout ${CIRCLE_BRANCH}
45+
# Verify that these commands work, they are later called in the incremental testing script
46+
# There output does not matter here, the fact that they finish successfully does.
47+
git rev-parse --abbrev-ref HEAD
48+
git merge-base master $(git rev-parse --abbrev-ref HEAD)
49+
git log --format=format:%H $(git merge-base master $(git rev-parse --abbrev-ref HEAD))..HEAD > /dev/null
50+
51+
- attach_workspace:
52+
at: ~/app
53+
54+
- restore_cache:
55+
key: yarn-v2-{{ checksum "yarn.lock" }}-{{ arch }}
56+
57+
- run:
58+
name: Delete @celo dir from node_modules (if its there)
59+
command: rm -rf ~/app/node_modules/@celo
60+
61+
- run:
62+
name: yarn
63+
command: |
64+
# Deals with yarn install flakiness which can come due to yarnpkg.com being
65+
# unreliable. For example, https://circleci.com/gh/celo-org/celo-monorepo/82685
66+
yarn install || yarn install
67+
68+
- run:
69+
name: Fail if someone forgot to commit "yarn.lock"
70+
command: |
71+
if [[ $(git status --porcelain) ]]; then
72+
echo "There are git differences after running yarn install"
73+
exit 1
74+
fi
75+
76+
- run: npm rebuild scrypt
77+
78+
- save_cache:
79+
key: yarn-v2-{{ checksum "yarn.lock" }}-{{ arch }}
80+
paths:
81+
- node_modules
82+
- packages/*/node_modules
83+
84+
- persist_to_workspace:
85+
root: .
86+
paths: .
87+
88+
lint-checks:
89+
<<: *defaults
90+
steps:
91+
- attach_workspace:
92+
at: ~/app
93+
94+
- run: yarn run ci-lint
95+
96+
general-test:
97+
<<: *defaults
98+
steps:
99+
- attach_workspace:
100+
at: ~/app
101+
102+
- run:
103+
name: jest tests
104+
command: |
105+
mkdir -p test-results/jest
106+
yarn run lerna --ignore @celo/mobile --ignore @celo/protocol --ignore @celo/celotool --ignore @celo/contractkit --ignore @celo/celocli run test
107+
108+
mobile-test-build-app:
109+
working_directory: ~/app
110+
docker:
111+
- image: circleci/android:api-28
112+
113+
steps:
114+
- attach_workspace:
115+
at: ~/app
116+
117+
- run:
118+
name: Build Android app (debug version)
119+
command: |
120+
set -euo pipefail
121+
cd packages/mobile/android
122+
ENVFILE=.env.test ./gradlew assembleDebug
123+
cd -
124+
125+
mobile-test:
126+
<<: *defaults
127+
steps:
128+
- attach_workspace:
129+
at: ~/app
130+
131+
- run:
132+
name: jest tests
133+
command: |
134+
mkdir -p test-results/jest
135+
# Tests fail with https://stackoverflow.com/questions/38558989/node-js-heap-out-of-memory without this
136+
NODE_OPTIONS="--max-old-space-size=4096" yarn --cwd packages/mobile test
137+
environment:
138+
JEST_JUNIT_OUTPUT: test-results/jest/junit.xml
139+
140+
- store_test_results:
141+
path: test-results
142+
143+
- store_artifacts:
144+
path: packages/mobile/coverage
145+
destination: mobile/coverage
146+
147+
- run:
148+
name: copy
149+
command: |
150+
mkdir -p packages/mobile/mobile/coverage
151+
cp -r packages/mobile/coverage packages/mobile/mobile/
152+
- run:
153+
name: Upload to CodeCov
154+
command: yarn codecov -F mobile
155+
156+
verification-pool-api:
157+
<<: *defaults
158+
steps:
159+
- attach_workspace:
160+
at: ~/app
161+
162+
- run:
163+
name: jest tests
164+
command: |
165+
mkdir -p test-results/jest
166+
yarn --cwd packages/verification-pool-api test
167+
environment:
168+
JEST_JUNIT_OUTPUT: test-results/jest/junit.xml
169+
170+
protocol-test:
171+
<<: *defaults
172+
steps:
173+
- attach_workspace:
174+
at: ~/app
175+
- run:
176+
name: Check if the test should run
177+
command: |
178+
DIRS_TO_CHECK="${PWD}/packages/protocol,${PWD}/packages/utils"
179+
./scripts/ci_check_if_test_should_run_v2.sh ${DIRS_TO_CHECK}
180+
- run:
181+
name: test
182+
# Flaky tests - run them twice
183+
command: yarn --cwd packages/protocol test || yarn --cwd packages/protocol test
184+
185+
cli-test:
186+
<<: *defaults
187+
steps:
188+
- attach_workspace:
189+
at: ~/app
190+
- run:
191+
name: Test
192+
command: |
193+
set -euo pipefail
194+
yarn --cwd=packages/cli test
195+
196+
end-to-end-geth-transfer-test:
197+
<<: *defaults
198+
steps:
199+
- attach_workspace:
200+
at: ~/app
201+
- run:
202+
name: Check if the test should run
203+
command: |
204+
DIRS_TO_CHECK="${PWD}/packages/celotool,${PWD}/packages/protocol"
205+
./scripts/ci_check_if_test_should_run_v2.sh ${DIRS_TO_CHECK}
206+
- run:
207+
name: Setup Go language
208+
command: |
209+
set -e
210+
set -v
211+
wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz
212+
tar xf go1.11.5.linux-amd64.tar.gz -C /tmp
213+
ls /tmp/go/bin/go
214+
/tmp/go/bin/go version
215+
- run:
216+
name: Run test
217+
no_output_timeout: 20m
218+
command: |
219+
set -e
220+
export PATH=${PATH}:/tmp/go/bin
221+
go version
222+
cd packages/celotool
223+
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
224+
./ci_test_transfers.sh checkout master
225+
226+
end-to-end-geth-governance-test:
227+
<<: *defaults
228+
steps:
229+
- attach_workspace:
230+
at: ~/app
231+
- run:
232+
name: Check if the test should run
233+
command: |
234+
DIRS_TO_CHECK="${PWD}/packages/celotool,${PWD}/packages/protocol"
235+
./scripts/ci_check_if_test_should_run_v2.sh ${DIRS_TO_CHECK}
236+
- run:
237+
name: Setup Go language
238+
command: |
239+
set -e
240+
set -v
241+
wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz
242+
tar xf go1.11.5.linux-amd64.tar.gz -C /tmp
243+
ls /tmp/go/bin/go
244+
/tmp/go/bin/go version
245+
- run:
246+
name: Run test
247+
no_output_timeout: 20m
248+
command: |
249+
set -e
250+
export PATH=${PATH}:/tmp/go/bin
251+
go version
252+
cd packages/celotool
253+
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
254+
./ci_test_governance.sh checkout master
255+
256+
end-to-end-geth-sync-test:
257+
<<: *defaults
258+
steps:
259+
- attach_workspace:
260+
at: ~/app
261+
- run:
262+
name: Check if the test should run
263+
command: |
264+
DIRS_TO_CHECK="${PWD}/packages/celotool,${PWD}/packages/protocol"
265+
./scripts/ci_check_if_test_should_run_v2.sh ${DIRS_TO_CHECK}
266+
- run:
267+
name: Setup Go language
268+
command: |
269+
set -e
270+
set -v
271+
wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz
272+
tar xf go1.11.5.linux-amd64.tar.gz -C /tmp
273+
ls /tmp/go/bin/go
274+
/tmp/go/bin/go version
275+
- run:
276+
name: Run test
277+
command: |
278+
set -e
279+
export PATH=${PATH}:/tmp/go/bin
280+
go version
281+
cd packages/celotool
282+
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
283+
./ci_test_sync.sh checkout master
284+
285+
web:
286+
working_directory: ~/app
287+
docker:
288+
- image: celohq/node8:gcloud
289+
steps:
290+
- attach_workspace:
291+
at: ~/app
292+
293+
- run: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
294+
- run: cd packages/web && ./circle_deploy.sh
295+
296+
workflows:
297+
version: 2
298+
celo-monorepo-build:
299+
jobs:
300+
- install_dependencies
301+
- lint-checks:
302+
requires:
303+
- install_dependencies
304+
- general-test:
305+
requires:
306+
- install_dependencies
307+
- lint-checks
308+
- mobile-test:
309+
requires:
310+
- install_dependencies
311+
- lint-checks
312+
- mobile-test-build-app:
313+
requires:
314+
- install_dependencies
315+
- lint-checks
316+
- verification-pool-api:
317+
requires:
318+
- install_dependencies
319+
- lint-checks
320+
- protocol-test:
321+
requires:
322+
- install_dependencies
323+
- end-to-end-geth-transfer-test:
324+
requires:
325+
- install_dependencies
326+
- end-to-end-geth-governance-test:
327+
requires:
328+
- install_dependencies
329+
- end-to-end-geth-sync-test:
330+
requires:
331+
- install_dependencies

.codecov.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
coverage:
2+
status:
3+
project:
4+
default: off
5+
mobile:
6+
paths: "packages/mobile/"
7+
flags: mobile
8+
threshold: 40%
9+
target: 10%
10+
# protocol:
11+
# paths: "packages/protocol/"
12+
# flags: protocol
13+
# threshold: 5%
14+
# target: 90%
15+
patch:
16+
default: off
17+
18+
flags:
19+
mobile:
20+
paths:
21+
- packages/mobile/
22+
# protocol:
23+
# paths:
24+
# - packages/protocol/

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages/mobile
2+
node_modules
3+
**/node_modules
4+
*node_modules

0 commit comments

Comments
 (0)