Skip to content

Add dependency caching, test runs, and precise path triggers in workflows - #305

Merged
nsalminen merged 1 commit into
google:mainfrom
nsalminen:gh-action-optimization
May 26, 2026
Merged

Add dependency caching, test runs, and precise path triggers in workflows#305
nsalminen merged 1 commit into
google:mainfrom
nsalminen:gh-action-optimization

Conversation

@nsalminen

Copy link
Copy Markdown
Collaborator

Optimize Github Action workflow execution efficiency by applying node_modules caching and precise path filters to the workflow checks. Also adds a testing step in the build workflow.

  • Implement actions/cache@v4 to cache node_modules in build-check, lint-format-check, docs-build-check, and build-branch workflows.
  • Add a npm run test step in the build-check workflow.
  • Add path filters to build-check and lint-format-check to prevent unnecessary executions on unrelated assets.
  • Constrain docs-build-check execution to documentation, core source, and configuration updates.

…lows

Optimize Github Action workflow execution efficiency by applying node_modules caching and precise path filters to the workflow checks. Also adds a testing step in the build workflow.

- Implement actions/cache@v4 to cache node_modules in build-check, lint-format-check, docs-build-check, and build-branch workflows.
- Add a `npm run test` step in the build-check workflow.
- Add path filters to build-check and lint-format-check to prevent unnecessary executions on unrelated assets.
- Constrain docs-build-check execution to documentation, core source, and configuration updates.
@nsalminen
nsalminen requested review from dli7319 and ruofeidu May 26, 2026 17:51

@ruofeidu ruofeidu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you Nels for optimizing the productivity!!

@dli7319

dli7319 commented May 26, 2026

Copy link
Copy Markdown
Collaborator

IIUC, actions/setup-node@v6 is already supposed to do caching.
Is this not true?

@nsalminen

Copy link
Copy Markdown
Collaborator Author

IIUC, actions/setup-node@v6 is already supposed to do caching. Is this not true?

@dli7319 As far as I know, actions/setup-node only caches global package tarballs to save download time, but still runs npm ci on every build. That unzipping, linking, and post-install execution adds about 45 seconds of runner overhead. The two methods are complementary: setup-node optimizes network downloads on cache misses, while our actions/cache setup restores node_modules instantly on cache hits, skipping the install step entirely.

@dli7319 dli7319 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good find!

@nsalminen
nsalminen merged commit e1cca51 into google:main May 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants