Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add coverage GitHub action #35653

Merged
merged 1 commit into from Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/coverage-linux.yml
@@ -0,0 +1,41 @@
# TODO(bcoe): add similar job for Windows coverage.
name: coverage-linux

on:
pull_request:
push:
branches:
- master

env:
PYTHON_VERSION: 3.9
FLAKY_TESTS: dontcare

jobs:
# TODO(bcoe): add support for C++ coverage.
coverage-linux:
runs-on: ubuntu-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: Environment Information
run: npx envinfo
- name: Build
run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn"
# 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little flummoxed as to why having NODE_V8_COVERAGE inline works great, whereas having it in the global env: stanza resulted in bad counts ... but there you have it, it's worked twice in a row with the environment variable here.

- name: Report
run: npx c8 report --check-coverage
- name: Output file count
run: ls -l coverage/tmp/ | wc -l
- name: Clean tmp
run: rm -rf coverage/tmp
- name: Upload
uses: codecov/codecov-action@v1
with:
directory: ./coverage
20 changes: 17 additions & 3 deletions .nycrc
@@ -1,7 +1,21 @@
{
"exclude": [
"**/internal/process/write-coverage.js"
"coverage/**",
"test/**",
"tools/**",
"benchmark/**",
"deps/**"
],
"compact": false,
"reporter": ["html", "text"]
"reporter": [
"html",
"text",
"lcov"
],
"lines": 95,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can ratchet this number up as we improve the linux coverage #s, and it will result in a failure to the action if it drops below the threshold.

"branches": "93",
"statements": "95",
"temp-directory": "coverage/tmp",
"omit-relative": false,
"resolve": "./lib",
"wrapper-length": 0
}