summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Coe <bencoe@google.com>2020-10-17 09:13:33 -0700
committerBenjamin Coe <bencoe@google.com>2020-10-21 19:41:08 -0700
commit7657f62b1810b94acbe7db68089b608213b34749 (patch)
tree8f0d56b731fc61b37235ec9dbcc48fb7a74902ee
parentdb4ce85cb7213c48384e371f4c53862f0af1022d (diff)
downloadnode-new-7657f62b1810b94acbe7db68089b608213b34749.tar.gz
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: https://github.com/nodejs/node/pull/35670 Fixes: https://github.com/nodejs/node/issues/35696 Refs: https://github.com/nodejs/node/pull/35653 Refs: https://github.com/nodejs/node/issues/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>
-rw-r--r--.github/workflows/coverage-linux.yml27
-rw-r--r--.github/workflows/coverage-windows.yml51
-rw-r--r--.nycrc2
-rw-r--r--Makefile1
-rw-r--r--codecov.yml10
5 files changed, 82 insertions, 9 deletions
diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml
index 5ebd89115b..002c2189b8 100644
--- a/.github/workflows/coverage-linux.yml
+++ b/.github/workflows/coverage-linux.yml
@@ -1,18 +1,26 @@
-# TODO(bcoe): add similar job for Windows coverage.
name: coverage-linux
on:
pull_request:
+ paths-ignore:
+ - 'doc/**'
+ - 'deps/**'
+ - 'benchmark/**'
+ - 'tools/**'
push:
branches:
- master
+ paths-ignore:
+ - 'doc/**'
+ - 'deps/**'
+ - 'benchmark/**'
+ - 'tools/**'
env:
PYTHON_VERSION: 3.9
FLAKY_TESTS: dontcare
jobs:
- # TODO(bcoe): add support for C++ coverage.
coverage-linux:
runs-on: ubuntu-latest
steps:
@@ -23,18 +31,21 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
run: npx envinfo
+ - name: Install gcovr
+ run: pip install gcovr==4.2
- name: Build
- run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn"
+ run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn --coverage"
# TODO(bcoe): fix the couple tests that fail with the inspector enabled.
# The cause is most likely coverage's use of the inspector.
- name: Test
- run: NODE_V8_COVERAGE=coverage/tmp make run-ci -j2 V=1 TEST_CI_ARGS="-p dots" || exit 0
- - name: Report
+ run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j2 V=1 TEST_CI_ARGS="-p dots" || exit 0
+ - name: Report JS
run: npx c8 report --check-coverage
- - name: Output file count
- run: ls -l coverage/tmp/ | wc -l
+ - name: Report C++
+ 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)
+ # Clean temporary output from gcov and c8, so that it's not uploaded:
- name: Clean tmp
- run: rm -rf coverage/tmp
+ run: rm -rf coverage/tmp && rm -rf out
- name: Upload
uses: codecov/codecov-action@v1
with:
diff --git a/.github/workflows/coverage-windows.yml b/.github/workflows/coverage-windows.yml
new file mode 100644
index 0000000000..ac0ef7b6e6
--- /dev/null
+++ b/.github/workflows/coverage-windows.yml
@@ -0,0 +1,51 @@
+name: coverage-windows
+
+on:
+ pull_request:
+ paths-ignore:
+ - 'doc/**'
+ - 'deps/**'
+ - 'benchmark/**'
+ - 'tools/**'
+ push:
+ branches:
+ - master
+ paths-ignore:
+ - 'doc/**'
+ - 'deps/**'
+ - 'benchmark/**'
+ - 'tools/**'
+
+env:
+ PYTHON_VERSION: 3.9
+ FLAKY_TESTS: dontcare
+
+jobs:
+ coverage-windows:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python ${{ env.PYTHON_VERSION }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - name: Install deps
+ run: choco install nasm
+ - name: Environment Information
+ run: npx envinfo
+ - name: Build
+ run: ./vcbuild.bat
+ # TODO(bcoe): investigate tests that fail with coverage enabled
+ # on Windows.
+ - name: Test
+ run: ./vcbuild.bat test-ci-js; node -e 'process.exit(0)'
+ env:
+ NODE_V8_COVERAGE: ./coverage/tmp
+ - name: Report
+ run: npx c8 report
+ - name: Clean tmp
+ run: npx rimraf ./coverage/tmp
+ - name: Upload
+ uses: codecov/codecov-action@v1
+ with:
+ directory: ./coverage
diff --git a/.nycrc b/.nycrc
index 6192a73a77..42aad37414 100644
--- a/.nycrc
+++ b/.nycrc
@@ -9,7 +9,7 @@
"reporter": [
"html",
"text",
- "lcov"
+ "cobertura"
],
"lines": 95,
"branches": "93",
diff --git a/Makefile b/Makefile
index e15b561156..b3a0a52e0d 100644
--- a/Makefile
+++ b/Makefile
@@ -294,6 +294,7 @@ v8:
.PHONY: jstest
jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
+ $(TEST_CI_ARGS) \
--skip-tests=$(CI_SKIP_TESTS) \
$(JS_SUITES) \
$(NATIVE_SUITES)
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000000..9808848a48
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,10 @@
+comment:
+ # Only show diff and files changed:
+ layout: "diff, files"
+ # Don't post if no changes in coverage:
+ require_changes: true
+
+codecov:
+ notify:
+ # Wait for all coverage builds:
+ after_n_builds: 2