Skip to content

Commit 665286d

Browse files
committed
ci: add codecov
1 parent fb53547 commit 665286d

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

.circleci/config.yml

+31-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: 2.1
2-
2+
33
defaults: &defaults
44
working_directory: ~/repo
55
docker:
@@ -31,6 +31,19 @@ yarn_install: &yarn_install
3131
name: Install Dependencies
3232
command: yarn install --frozen-lockfile --non-interactive
3333

34+
codecov_install: &codecov_install
35+
name: Install codecov
36+
command: |
37+
if [ ! -f ./codecov ]; then
38+
curl -Os https://uploader.codecov.io/v0.1.0_4653/linux/codecov
39+
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
40+
curl -Os https://uploader.codecov.io/latest/linux/codecov
41+
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
42+
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
43+
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
44+
shasum -a 256 -c codecov.SHA256SUM
45+
chmod +x codecov
46+
fi
3447
jobs:
3548
install:
3649
<<: *defaults
@@ -45,6 +58,16 @@ jobs:
4558
paths:
4659
- ~/.cache
4760
- node_modules
61+
- restore_cache:
62+
keys:
63+
- codecov-0.1.0_4653
64+
- run:
65+
<<: *codecov_install
66+
- save_cache:
67+
key: codecov-0.1.0_4653
68+
paths:
69+
- ./codecov
70+
4871
lint:
4972
<<: *defaults
5073
steps:
@@ -64,9 +87,14 @@ jobs:
6487
<<: *set_env
6588
- restore_cache:
6689
<<: *yarn_cache
67-
- run: yarn nx affected --target=test --head=HEAD --ci --code-coverage --maxWorkers=2 ${AFFECTED_ARGS}
90+
- restore_cache:
91+
keys:
92+
- codecov-0.1.0_4653
93+
- run: yarn nx affected --target=test --head=HEAD --ci --coverage --maxWorkers=2 --coverageReporters=lcov ${AFFECTED_ARGS}
6894
# --maxWorkers=2 is required because we'll run virtual machine with 32 cores CPU (with actually 4 CPI), jest spawns lots of workers if we don't fix the worker size.
6995
# https://support.circleci.com/hc/en-us/articles/360005442714-Your-test-tools-are-smart-and-that-s-a-problem-Learn-about-when-optimization-goes-wrong-
96+
- run: ./codecov -t ${CODECOV_TOKEN}
97+
7098
workflows:
7199
version: 2
72100
pr-check:
@@ -77,4 +105,4 @@ workflows:
77105
- install
78106
- test:
79107
requires:
80-
- install
108+
- install

0 commit comments

Comments
 (0)