-
Notifications
You must be signed in to change notification settings - Fork 822
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
ci: add npm cache in actions/setup-node #4271
Conversation
8bfa115
to
2cd21d6
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4271 +/- ##
=======================================
Coverage 92.20% 92.20%
=======================================
Files 332 332
Lines 9439 9439
Branches 2000 2000
=======================================
Hits 8703 8703
Misses 736 736 |
@@ -17,10 +17,13 @@ jobs: | |||
NPM_CONFIG_UNSAFE_PERM: true | |||
steps: | |||
- name: Checkout | |||
uses: actions/checkout@v3 | |||
uses: actions/checkout@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be out of scope for this PR, but all other workflows touched in this PR were already using v4. Let me know if it makes more sense to leave it out of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to keep it in this PR👍
Most likely it was an oversight.
762e549
to
ed2d410
Compare
ed2d410
to
5da12f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks 🙂
@@ -17,10 +17,13 @@ jobs: | |||
NPM_CONFIG_UNSAFE_PERM: true | |||
steps: | |||
- name: Checkout | |||
uses: actions/checkout@v3 | |||
uses: actions/checkout@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to keep it in this PR👍
Most likely it was an oversight.
The CI failure was caused by https://github.com/open-telemetry/opentelemetry-js/blob/8067d9721021cb25f94534a27cd2e6298ef7f6a2/.npmrc#L1C10-L1C10, which would cause npm bundled with node v14 and lower to abort. I think the |
Ah that's my fault. I added this - I'll remove it again. It's not yet used anyway. (PR to remove it: #4329) |
cache-dependency-path: | | ||
package-lock.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/actions/setup-node#caching-global-packages-data suggests that package-lock.json
will be used as a default:
The action defaults to search for the dependency file (package-lock.json, npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its hash as a part of the cache key. Use cache-dependency-path for cases when multiple dependency files are used, or they are located in different subdirectories.
However, I think it is fine either way.
- uses: actions/setup-node@v4 | ||
with: | ||
cache: 'npm' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious if we are able to notice any speed up in npm ci
steps in this or other workflows as a result of caching. With the variable GitHub Action runners it may be hard to get reliable numbers, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell from a quick small number of checks at https://github.com/open-telemetry/opentelemetry-js/actions/workflows/unit-test.yml for node-test (v18), the run time reduced from 2m35s to about 2m with this PR.
Thanks @lyzlisa! |
* Add Trent to approvers (#4311) * chore(renovate): require dashboard approval for lerna updates (#4276) * chore(ci): install semver globally to speed up "peer-api" workflow (#4270) Closes: #4242 * fix(ci): remove token setup via environment variable from .npmrc (#4329) * fix(instrumentation-http): resume responses when there is no response listener Fixes a memory leak where unhandled response bodies pile up in node 20 * feat: add script to update changelogs on release preparation (#4315) * feat: add script to update changelogs on releases * fix: address comments * Apply suggestions from code review Co-authored-by: Trent Mick <[email protected]> * fix: apply suggestions from code review * fix: use packageJson.version instead of version --------- Co-authored-by: Trent Mick <[email protected]> * Fix event name * test: make rawRequest HTTP-compliant * Add node 20 to test matrix * Enable old hash functions on 20 * Fix esm handling for iitm node 20 * Use err.code to make test more reliable * Changelog * nit: single import * Remove unused files * Add v20 to supported runtimes * ci: add npm cache in actions/setup-node (#4271) * feat(sdk-logs): add droppedAttributesCount field to ReadableLogRecord (#4289) * feat(sdk-logs): add droppedAttributesCount field to ReadableLogRecord * chore: check droppedAttributesCount value in test case * feat(otlp-transformer): make toLogRecord() use ReadableLogRecord.droppedAttributesCount --------- Co-authored-by: Marc Pichler <[email protected]> * fix(api-logs): allow passing in TimeInput for LogRecord (#4345) * fix: allow passing in TimeInput for LogRecord * chore: update changelog * fix: programmatic url and headers take precedence in metric exporters… (#4334) * fix: programmatic url and headers take precedence in metric exporters (#2370) * chore: adjust grpc exporter metrics test * chore(changelog): update changelog * fix(instrumentation-http): do not mutate given headers object for outgoing http requests (#4346) Fixes: open-telemetry/opentelemetry-js-contrib#1609 * chore(deps): update actions/stale action to v9 (#4353) * fix(deps): update dependency import-in-the-middle to v1.6.0 (#4357) * chore(deps): update all patch versions (#4306) * chore(ci): use node 20 in lint workflow (#4359) * chore(deps): update dependency linkinator to v6 (#4237) * fix(otlp-exporter-base): decrease default concurrency limit to 30 (#4211) * fix(otlp-exporter-base): decrease concurrency limit to 30 * fix(changelog): add changelog entry * chore(deps): use actions/checkout >4 instead of 4.0.0 exactly (#4361) --------- Co-authored-by: Marc Pichler <[email protected]> Co-authored-by: strivly <[email protected]> Co-authored-by: Trent Mick <[email protected]> Co-authored-by: lyzlisa <[email protected]> Co-authored-by: Hyun Oh <[email protected]> Co-authored-by: Siim Kallas <[email protected]> Co-authored-by: Vladimir Adamić <[email protected]> Co-authored-by: Mend Renovate <[email protected]>
Which problem is this PR solving?
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #4243
Short description of the changes
Enable cache in
actions/setup-node
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: