Skip to content

Commit 11eca36

Browse files
bcoetargos
authored andcommitted
test: add windows and C++ coverage
Collect Windows and C++ coverage. Configure codecov so that comments are more concise and are only left when coverage varies. PR-URL: #35670 Fixes: #35696 Refs: #35653 Refs: #35646 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 894419c commit 11eca36

File tree

5 files changed

+82
-9
lines changed

5 files changed

+82
-9
lines changed

.github/workflows/coverage-linux.yml

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
# TODO(bcoe): add similar job for Windows coverage.
21
name: coverage-linux
32

43
on:
54
pull_request:
5+
paths-ignore:
6+
- 'doc/**'
7+
- 'deps/**'
8+
- 'benchmark/**'
9+
- 'tools/**'
610
push:
711
branches:
812
- master
13+
paths-ignore:
14+
- 'doc/**'
15+
- 'deps/**'
16+
- 'benchmark/**'
17+
- 'tools/**'
918

1019
env:
1120
PYTHON_VERSION: 3.9
1221
FLAKY_TESTS: dontcare
1322

1423
jobs:
15-
# TODO(bcoe): add support for C++ coverage.
1624
coverage-linux:
1725
runs-on: ubuntu-latest
1826
steps:
@@ -23,18 +31,21 @@ jobs:
2331
python-version: ${{ env.PYTHON_VERSION }}
2432
- name: Environment Information
2533
run: npx envinfo
34+
- name: Install gcovr
35+
run: pip install gcovr==4.2
2636
- name: Build
27-
run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn"
37+
run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn --coverage"
2838
# TODO(bcoe): fix the couple tests that fail with the inspector enabled.
2939
# The cause is most likely coverage's use of the inspector.
3040
- 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
41+
run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j2 V=1 TEST_CI_ARGS="-p dots" || exit 0
42+
- name: Report JS
3343
run: npx c8 report --check-coverage
34-
- name: Output file count
35-
run: ls -l coverage/tmp/ | wc -l
44+
- name: Report C++
45+
run: cd out && gcovr --gcov-exclude='.*\b(deps|usr|out|obj|cctest|embedding)\b' -v -r Release/obj.target --xml -o ../coverage/coverage-cxx.xml --root=$(cd ../ && pwd)
46+
# Clean temporary output from gcov and c8, so that it's not uploaded:
3647
- name: Clean tmp
37-
run: rm -rf coverage/tmp
48+
run: rm -rf coverage/tmp && rm -rf out
3849
- name: Upload
3950
uses: codecov/codecov-action@v1
4051
with:
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: coverage-windows
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- 'doc/**'
7+
- 'deps/**'
8+
- 'benchmark/**'
9+
- 'tools/**'
10+
push:
11+
branches:
12+
- master
13+
paths-ignore:
14+
- 'doc/**'
15+
- 'deps/**'
16+
- 'benchmark/**'
17+
- 'tools/**'
18+
19+
env:
20+
PYTHON_VERSION: 3.9
21+
FLAKY_TESTS: dontcare
22+
23+
jobs:
24+
coverage-windows:
25+
runs-on: windows-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up Python ${{ env.PYTHON_VERSION }}
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: ${{ env.PYTHON_VERSION }}
32+
- name: Install deps
33+
run: choco install nasm
34+
- name: Environment Information
35+
run: npx envinfo
36+
- name: Build
37+
run: ./vcbuild.bat
38+
# TODO(bcoe): investigate tests that fail with coverage enabled
39+
# on Windows.
40+
- name: Test
41+
run: ./vcbuild.bat test-ci-js; node -e 'process.exit(0)'
42+
env:
43+
NODE_V8_COVERAGE: ./coverage/tmp
44+
- name: Report
45+
run: npx c8 report
46+
- name: Clean tmp
47+
run: npx rimraf ./coverage/tmp
48+
- name: Upload
49+
uses: codecov/codecov-action@v1
50+
with:
51+
directory: ./coverage

.nycrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"reporter": [
1010
"html",
1111
"text",
12-
"lcov"
12+
"cobertura"
1313
],
1414
"lines": 95,
1515
"branches": "93",

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ v8:
294294
.PHONY: jstest
295295
jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
296296
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
297+
$(TEST_CI_ARGS) \
297298
--skip-tests=$(CI_SKIP_TESTS) \
298299
$(JS_SUITES) \
299300
$(NATIVE_SUITES)

codecov.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
comment:
2+
# Only show diff and files changed:
3+
layout: "diff, files"
4+
# Don't post if no changes in coverage:
5+
require_changes: true
6+
7+
codecov:
8+
notify:
9+
# Wait for all coverage builds:
10+
after_n_builds: 2

0 commit comments

Comments
 (0)