From bb2945ed6b8e7cc94d485de6cb8377885ee352c4 Mon Sep 17 00:00:00 2001 From: bcoe Date: Wed, 14 Oct 2020 19:21:17 -0700 Subject: [PATCH] build: add GitHub Action for code coverage PR-URL: https://github.com/nodejs/node/pull/35653 Reviewed-By: Rich Trott Reviewed-By: Richard Lau Reviewed-By: Daijiro Wachi --- .github/workflows/coverage-linux.yml | 41 ++++++++++++++++++++++++++++ .nycrc | 20 ++++++++++++-- 2 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/coverage-linux.yml diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml new file mode 100644 index 00000000000..5ebd89115b4 --- /dev/null +++ b/.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 + - 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 diff --git a/.nycrc b/.nycrc index c826fbc02d5..6192a73a77b 100644 --- a/.nycrc +++ b/.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, + "branches": "93", + "statements": "95", + "temp-directory": "coverage/tmp", + "omit-relative": false, + "resolve": "./lib", + "wrapper-length": 0 }