Skip to content

Commit 14d5781

Browse files
authored
Add Codecov shared settings (#11)
1 parent 30023ef commit 14d5781

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

.github/workflows/workflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ jobs:
2929
if: "${{ matrix.node-version == '14.x' }}"
3030
- name: Tests
3131
run: npm run test:ci
32+
- name: Codecov test coverage
33+
run: bash bin/report_coverage.sh "${{ matrix.os }}" "${{ matrix.node-version }}"

bin/report_coverage.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
# Upload test coverage to Codecov
3+
# We need to use a Bash script instead of using a npm script or the official
4+
# GitHub action because we want to send OS and Node.js version as flags.
5+
# Codecov does not support dots nor dashes in flags. However, GitHub actions
6+
# variables for those do, so we need to strip them.
7+
8+
os="$1"
9+
os="${os/-latest/}"
10+
11+
node="$2"
12+
node="node_${node//./_}"
13+
14+
# We don't use the -Z flag (which makes CI build fail on upload error) and we
15+
# use the --fail flag (which does not make CI build fail on curl error) because
16+
# Codecov API fails too often.
17+
curl --fail -s https://codecov.io/bash | \
18+
bash -s -- -f coverage/coverage-final.json -F "$os" -F "$node"

codecov.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
codecov:
2+
strict_yaml_branch: master
3+
coverage:
4+
range: [80, 100]
5+
parsers:
6+
javascript:
7+
enable_partials: true
8+
status:
9+
project: false
10+
patch: false
11+
comment: false

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"bin"
1111
],
1212
"bin": {
13-
"run-e": "./bin/run_e.js"
13+
"run-e": "./bin/run_e.js",
14+
"report_coverage": "./bin/report_coverage.sh"
1415
},
1516
"scripts": {
1617
"test": "run-s format test:dev",

0 commit comments

Comments
 (0)