Skip to content

Commit

Permalink
build: update gcovr to 7.2 and codecov config
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Jul 25, 2024
1 parent fcda284 commit 0821fe5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/coverage-linux-without-intl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- tools/gyp/**
- tools/test.py
- .github/workflows/coverage-linux-without-intl.yml
- codecov.yml
push:
branches:
- main
Expand All @@ -24,6 +25,7 @@ on:
- tools/gyp/**
- tools/test.py
- .github/workflows/coverage-linux-without-intl.yml
- codecov.yml

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -58,7 +60,7 @@ jobs:
- name: Environment Information
run: npx envinfo
- name: Install gcovr
run: pip install gcovr==4.2
run: pip install gcovr==7.2
- name: Build
run: make build-ci -j4 V=1 CONFIG_FLAGS="--error-on-warn --coverage --without-intl"
# TODO(bcoe): fix the couple tests that fail with the inspector enabled.
Expand All @@ -70,7 +72,7 @@ jobs:
env:
NODE_OPTIONS: --max-old-space-size=8192
- 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)
run: gcovr --object-directory=out -v --filter src --xml -o ./coverage/coverage-cxx.xml --root=./ --gcov-executable="llvm-cov-18 gcov"
# Clean temporary output from gcov and c8, so that it's not uploaded:
- name: Clean tmp
run: rm -rf coverage/tmp && rm -rf out
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/coverage-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- tools/gyp/**
- tools/test.py
- .github/workflows/coverage-linux.yml
- codecov.yml
push:
branches:
- main
Expand All @@ -24,6 +25,7 @@ on:
- tools/gyp/**
- tools/test.py
- .github/workflows/coverage-linux.yml
- codecov.yml

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -58,7 +60,7 @@ jobs:
- name: Environment Information
run: npx envinfo
- name: Install gcovr
run: pip install gcovr==4.2
run: pip install gcovr==7.2
- name: Build
run: make build-ci -j4 V=1 CONFIG_FLAGS="--error-on-warn --coverage"
# TODO(bcoe): fix the couple tests that fail with the inspector enabled.
Expand All @@ -70,7 +72,7 @@ jobs:
env:
NODE_OPTIONS: --max-old-space-size=8192
- 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)
run: gcovr --object-directory=out -v --filter src --xml -o ./coverage/coverage-cxx.xml --root=./ --gcov-executable="llvm-cov-18 gcov"
# Clean temporary output from gcov and c8, so that it's not uploaded:
- name: Clean tmp
run: rm -rf coverage/tmp && rm -rf out
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/coverage-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- tools/gyp/**
- tools/test.py
- .github/workflows/coverage-windows.yml
- codecov.yml
push:
branches:
- main
Expand All @@ -24,6 +25,7 @@ on:
- tools/gyp/**
- tools/test.py
- .github/workflows/coverage-windows.yml
- codecov.yml

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ coverage: coverage-test ## Run the tests and generate a coverage report.
.PHONY: coverage-build
coverage-build: all
-$(MAKE) coverage-build-js
if [ ! -d gcovr ]; then $(PYTHON) -m pip install -t gcovr gcovr==4.2; fi
if [ ! -d gcovr ]; then $(PYTHON) -m pip install -t gcovr gcovr==7.2; fi
$(MAKE)

.PHONY: coverage-build-js
Expand All @@ -269,9 +269,10 @@ coverage-test: coverage-build
-NODE_V8_COVERAGE=coverage/tmp \
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS)
$(MAKE) coverage-report-js
-(cd out && PYTHONPATH=../gcovr $(PYTHON) -m gcovr \
--gcov-exclude='.*\b(deps|usr|out|cctest|embedding)\b' -v \
-r ../src/ --object-directory Release/obj.target \
-(PYTHONPATH=./gcovr $(PYTHON) -m gcovr \
--object-directory=out \
--filter src -v \
--root ./ \
--html --html-details -o ../coverage/cxxcoverage.html \
--gcov-executable="$(GCOV)")
@printf "Javascript coverage %%: "
Expand Down
19 changes: 10 additions & 9 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# TODO(bcoe): re-enable coverage report comments, once we can figure out
# how to make them more accurate for the Node.js project,
# See: https://github.com/nodejs/node/issues/35759
comment: false
# # Only show diff and files changed:
# layout: "diff, files"
# # Don't post if no changes in coverage:
# require_changes: true
comment:
# Only show diff and files changed:
layout: diff, files
# Don't post if no changes in coverage:
require_changes: true

codecov:
branch: main
notify:
# Wait for all coverage builds:
after_n_builds: 2
# - coverage-linux.yml
# - coverage-windows.yml
# - coverage-linux-without-intl.yml
after_n_builds: 3

coverage:
# Useful for blocking Pull Requests that don't meet a particular coverage threshold.
status:
project: off
patch: off

0 comments on commit 0821fe5

Please sign in to comment.