ci(workflow): workflow execution optimizations
Description
While reviewing pr-testing-with-test-project.yml, I noticed a couple of opportunities to further optimize the workflow execution. I'd like to discuss whether these improvements would be appropriate before opening individual PRs.
1. Add workflow concurrency
Currently, multiple workflow runs can execute simultaneously when several commits are pushed to the same PR in quick succession, even though only the latest run is relevant.
Proposed change:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
Benefits:
- Cancel outdated workflow runs automatically.
- Reduce unnecessary CI resource usage.
- Provide faster feedback for the latest commit.
2. Cache npm dependencies
The workflow installs dependencies using npm ci on every run. Enabling the built-in npm cache in actions/setup-node could reduce setup time.
Proposed change:
- uses: actions/setup-node@v4
with:
node-version: "${{ steps.lockversion.outputs.version }}"
cache: npm
(If needed, cache-dependency-path can be configured based on the repository's lockfile location.)
Benefits:
- Faster dependency installation.
- Reduced workflow execution time.
- Lower network usage during CI.
@derberg please a look at it.
@SHUBHANSHU602 the issue is valid you can work on it!
@SHUBHANSHU602 can i work on this issue, it would be great to do CI integration work
@NiravDongre I have already done most of work just doing some research on npm caching part . So if u wish to contribute please find another issue. There are many approved issue u can try them.
@SHUBHANSHU602 ok, hope you can complete your research