Improve speed of CI tests with cacheing - #4211
Conversation
| - name: Cache wait-on | ||
| uses: actions/cache@v4 | ||
| id: wait-on-cache | ||
| with: | ||
| path: ~/.npm/_npx | ||
| key: npx-wait-on-${{ env.WAIT_ON_VERSION }}-${{ runner.os }} | ||
|
|
||
| - name: Install wait-on | ||
| if: steps.wait-on-cache.outputs.cache-hit != 'true' | ||
| run: npx -y wait-on@$WAIT_ON_VERSION --version | ||
|
|
There was a problem hiding this comment.
previously we were doing the wait-on install in ln 103
I separated it in case cacheing it would help
I don't think it makes a huge difference (3s) but also doesn't hurt
| - uses: actions/checkout@v2 | ||
| - name: Use Node.js | ||
| uses: actions/setup-node@v1 | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'npm' | ||
|
|
||
| - name: Create .env file | ||
| run: cp .env.example .env | ||
|
|
||
| - name: Cache node_modules | ||
| uses: actions/cache@v4 | ||
| id: node-modules-cache | ||
| with: | ||
| node-version: '18.20.x' | ||
| - run: npm install |
There was a problem hiding this comment.
checkout v2 and setup-node v1 are really old so I bumped them both up to 4 to match e2e.yml. Also wasn't sure if cache@v4 required these to be v4
| path: node_modules | ||
| key: node-modules-${{ runner.os }}-node-${{ hashFiles('.nvmrc') }}-${{ hashFiles('package-lock.json') }} | ||
|
|
||
| - name: Install dependencies |
There was a problem hiding this comment.
Sorry if this is is something I could've noted earlier! I think I feel a little cautious about caching node_modulesbecause of the potential for consistency issues with cached installs. However, I don't think this is a major concern, especially since we want this to align with what we have ine2e.yml`, and the runtime improvements are nice!
|
Sorry for the belated review, I think this overall looks good! I think once the merge conflicts are resolved (which I'm assuming might also happen in 4210), we can get this in! |
Issue:
Fixes #
Demo:
test.yml before vs after hitting the node_modules cache

e2e.yml before and after hitting the node_modules cache

Changes:
I have verified that this pull request:
npm run lint)npm run test)npm run typecheck)developbranch.Fixes #123