Skip to content

Commit bfd9d7f

Browse files
mohammadalfaiyazbitgopranavjain97
authored andcommitted
ci: cache node modules between runners
1 parent fb718a4 commit bfd9d7f

2 files changed

Lines changed: 40 additions & 44226 deletions

File tree

.github/workflows/build-and-test.yaml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ jobs:
2525
node-version: ${{ inputs.node-version }}
2626
cache: 'yarn'
2727

28+
- name: Cache dependencies
29+
uses: actions/cache@v3
30+
id: node-modules-cache
31+
with:
32+
path: '**/node_modules'
33+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-modules-
36+
2837
- name: Install dependencies
38+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
2939
run: yarn install
3040

3141
- name: Validate PR commits with commitlint
@@ -44,7 +54,17 @@ jobs:
4454
node-version: ${{ inputs.node-version }}
4555
cache: 'yarn'
4656

57+
- name: Cache dependencies
58+
uses: actions/cache@v3
59+
id: node-modules-cache
60+
with:
61+
path: '**/node_modules'
62+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
63+
restore-keys: |
64+
${{ runner.os }}-modules-
65+
4766
- name: Install dependencies
67+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
4868
run: yarn install
4969

5070
- name: Build
@@ -53,7 +73,6 @@ jobs:
5373
lint:
5474
name: Run lint
5575
runs-on: ubuntu-latest
56-
needs: [commit-lint]
5776
steps:
5877
- name: Checkout
5978
uses: actions/checkout@v4
@@ -64,7 +83,17 @@ jobs:
6483
node-version: ${{ inputs.node-version }}
6584
cache: 'yarn'
6685

86+
- name: Cache dependencies
87+
uses: actions/cache@v3
88+
id: node-modules-cache
89+
with:
90+
path: '**/node_modules'
91+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
92+
restore-keys: |
93+
${{ runner.os }}-modules-
94+
6795
- name: Install dependencies
96+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
6897
run: yarn install
6998

7099
- name: Lint
@@ -83,7 +112,17 @@ jobs:
83112
node-version: ${{ inputs.node-version }}
84113
cache: 'yarn'
85114

115+
- name: Cache dependencies
116+
uses: actions/cache@v3
117+
id: node-modules-cache
118+
with:
119+
path: '**/node_modules'
120+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
121+
restore-keys: |
122+
${{ runner.os }}-modules-
123+
86124
- name: Install dependencies
125+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
87126
run: yarn install
88127

89128
- name: Generate test SSL certificates

0 commit comments

Comments
 (0)