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

chore: Update c8 to merge v8 coverage reports asynchronously to avoid OOM issues #1652

Merged
merged 2 commits into from
May 31, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,16 @@ jobs:
env:
VERSIONED_MODE: ${{ github.ref == 'refs/heads/main' && '--minor' || '--major' }}
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
C8_REPORTER: lcovonly
- name: Run Versioned Tests (npm v7 / Node 16+)
if: ${{ matrix.node-version != '14.x' }}
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:npm7
env:
VERSIONED_MODE: ${{ github.ref == 'refs/heads/main' && '--minor' || '--major' }}
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
C8_REPORTER: lcovonly
- name: Archive Versioned Test Coverage
uses: actions/upload-artifact@v3
if: github.ref != 'refs/heads/main'
with:
name: versioned-tests-${{ matrix.node-version }}
path: ./coverage/versioned/lcov.info
Expand Down Expand Up @@ -164,7 +165,6 @@ jobs:
flags: integration-tests-${{ matrix.node-version }}
- name: Post Versioned Test Coverage
uses: codecov/codecov-action@v3
if: github.ref != 'refs/heads/main'
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: versioned-tests-${{ matrix.node-version }}
Expand Down
45 changes: 2 additions & 43 deletions .github/workflows/versioned-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Daily workflow to gather coverage of our versioned tests from the `main` branch
# This workflow is intended to be used to run versioned tests for different scenarios(i.e.- async local context manager, agent + security agent, etc)

# Reason: We run the versioned tests on main with the `--minor` flag, which causes
# c8 to OOM. So instead, we will have this daily job to scrape the coverage every
# weekday until we can figure out the c8 issue

name: Gather Versioned Test Coverage
name: Nightly Versioned Scenario Runs

on:
workflow_dispatch:
Expand Down Expand Up @@ -35,40 +31,3 @@ jobs:
VERSIONED_MODE: --major
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
SKIP_C8: true

versioned:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Run Docker Services
run: npm run services
- name: Run Versioned Tests (npm v6 / Node 12/14)
if: ${{ matrix.node-version == '14.x' }}
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:npm6
env:
VERSIONED_MODE: --major
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
- name: Run Versioned Tests (npm v7 / Node 16+)
if: ${{ matrix.node-version != '14.x' }}
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:npm7
env:
VERSIONED_MODE: --major
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
- name: Post Versioned Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/versioned/
files: lcov.info
flags: versioned-tests-${{ matrix.node-version }}
2 changes: 1 addition & 1 deletion THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,7 @@ THE SOFTWARE.

### c8

This product includes source derived from [c8](https://github.com/bcoe/c8) ([v7.12.0](https://github.com/bcoe/c8/tree/v7.12.0)), distributed under the [ISC License](https://github.com/bcoe/c8/blob/v7.12.0/LICENSE.txt):
This product includes source derived from [c8](https://github.com/bcoe/c8) ([v7.14.0](https://github.com/bcoe/c8/tree/v7.14.0)), distributed under the [ISC License](https://github.com/bcoe/c8/blob/v7.14.0/LICENSE.txt):

```
Copyright (c) 2017, Contributors
Expand Down
17 changes: 6 additions & 11 deletions bin/run-versioned-tests.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we also want to unleash the koa tests now that c8 supports async merge? Currently they're locked down to a sample of 5, which still results in 128 runs with the minor flag

https://github.com/newrelic/node-newrelic-koa/pull/148/files#diff-bdac2f5bfe1a2d5ea7f375061960ebb16d13f7541b4e1ebc2f30fc55b9975187

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's fine to keep

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ VERSIONED_MODE="${VERSIONED_MODE:---minor}"
SAMPLES="${SAMPLES:-10}"
export NODE_OPTIONS="--max-old-space-size=4096"
SKIP_C8="${SKIP_C8:-false}"
# In CI we only want to run lcovonly
# but when running locally we want to see the beautiful
Copy link
Contributor

Choose a reason for hiding this comment

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

👏🏻 thank you! i use the html reports all the time

# HTML reports too
C8_REPORTER="${C8_REPORTER:-lcov}"

# Determine context manager for sanity sake
if [[ $NEW_RELIC_FEATURE_FLAG_ASYNC_LOCAL_CONTEXT == 1 ]];
Expand Down Expand Up @@ -40,17 +44,8 @@ if [[ "${SKIP_C8}" = "true" ]];
then
C8=""
else
# C8 runs out of heap when running against
# patch/minor flag. We will just skip it
# and figure out another way to get coverage
# when running on main branch.
if [[ $VERSIONED_MODE == '--major' ]];
then
# lcovonly only generates lcov report which will cut down on amount of time generating reports
C8="c8 -o ./coverage/versioned -r lcovonly"
else
C8=""
fi
# lcovonly only generates lcov report which will cut down on amount of time generating reports
C8="c8 -o ./coverage/versioned --merge-async -r $C8_REPORTER"
fi

export AGENT_PATH=`pwd`
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
"@slack/bolt": "^3.7.0",
"ajv": "^6.12.6",
"async": "^3.2.4",
"c8": "^7.12.0",
"c8": "^7.14.0",
"chai": "^4.1.2",
"clean-jsdoc-theme": "^4.2.4",
"commander": "^7.0.0",
Expand Down
12 changes: 6 additions & 6 deletions third_party_manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lastUpdated": "Thu May 11 2023 16:39:40 GMT-0400 (Eastern Daylight Time)",
"lastUpdated": "Tue May 30 2023 14:26:27 GMT-0400 (Eastern Daylight Time)",
"projectName": "New Relic Node Agent",
"projectUrl": "https://github.com/newrelic/node-newrelic",
"includeOptDeps": true,
Expand Down Expand Up @@ -310,15 +310,15 @@
"licenseTextSource": "file",
"publisher": "Caolan McMahon"
},
"c8@7.12.0": {
"c8@7.14.0": {
"name": "c8",
"version": "7.12.0",
"range": "^7.12.0",
"version": "7.14.0",
"range": "^7.14.0",
"licenses": "ISC",
"repoUrl": "https://github.com/bcoe/c8",
"versionedRepoUrl": "https://github.com/bcoe/c8/tree/v7.12.0",
"versionedRepoUrl": "https://github.com/bcoe/c8/tree/v7.14.0",
"licenseFile": "node_modules/c8/LICENSE.txt",
"licenseUrl": "https://github.com/bcoe/c8/blob/v7.12.0/LICENSE.txt",
"licenseUrl": "https://github.com/bcoe/c8/blob/v7.14.0/LICENSE.txt",
"licenseTextSource": "file",
"publisher": "Ben Coe",
"email": "ben@npmjs.com"
Expand Down
Loading