Skip to content

Commit bb2945e

Browse files
bcoeTrott
authored andcommitted
build: add GitHub Action for code coverage
PR-URL: #35653 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent 35a6946 commit bb2945e

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

.github/workflows/coverage-linux.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# TODO(bcoe): add similar job for Windows coverage.
2+
name: coverage-linux
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
env:
11+
PYTHON_VERSION: 3.9
12+
FLAKY_TESTS: dontcare
13+
14+
jobs:
15+
# TODO(bcoe): add support for C++ coverage.
16+
coverage-linux:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python ${{ env.PYTHON_VERSION }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ env.PYTHON_VERSION }}
24+
- name: Environment Information
25+
run: npx envinfo
26+
- name: Build
27+
run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn"
28+
# TODO(bcoe): fix the couple tests that fail with the inspector enabled.
29+
# The cause is most likely coverage's use of the inspector.
30+
- name: Test
31+
run: NODE_V8_COVERAGE=coverage/tmp make run-ci -j2 V=1 TEST_CI_ARGS="-p dots" || exit 0
32+
- name: Report
33+
run: npx c8 report --check-coverage
34+
- name: Output file count
35+
run: ls -l coverage/tmp/ | wc -l
36+
- name: Clean tmp
37+
run: rm -rf coverage/tmp
38+
- name: Upload
39+
uses: codecov/codecov-action@v1
40+
with:
41+
directory: ./coverage

.nycrc

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
{
22
"exclude": [
3-
"**/internal/process/write-coverage.js"
3+
"coverage/**",
4+
"test/**",
5+
"tools/**",
6+
"benchmark/**",
7+
"deps/**"
48
],
5-
"compact": false,
6-
"reporter": ["html", "text"]
9+
"reporter": [
10+
"html",
11+
"text",
12+
"lcov"
13+
],
14+
"lines": 95,
15+
"branches": "93",
16+
"statements": "95",
17+
"temp-directory": "coverage/tmp",
18+
"omit-relative": false,
19+
"resolve": "./lib",
20+
"wrapper-length": 0
721
}

0 commit comments

Comments
 (0)