Skip to content

Commit 7bdc9af

Browse files
author
Luca Forstner
authored
ci: Use dependency cache (#259)
1 parent 47d02ea commit 7bdc9af

File tree

1 file changed

+65
-9
lines changed

1 file changed

+65
-9
lines changed

.github/workflows/checks.yml

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ jobs:
1616
- uses: actions/setup-node@v3
1717
with:
1818
node-version-file: "package.json"
19-
- run: yarn --frozen-lockfile
19+
- name: Use dependency cache
20+
uses: actions/cache@v3
21+
id: cache
22+
with:
23+
path: "**/node_modules"
24+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
25+
- name: Install dependencies
26+
run: yarn --frozen-lockfile --ignore-engines
27+
if: steps.cache.outputs.cache-hit != 'true'
2028
- run: yarn build
2129

2230
type-check:
@@ -28,7 +36,15 @@ jobs:
2836
- uses: actions/setup-node@v3
2937
with:
3038
node-version-file: "package.json"
31-
- run: yarn --frozen-lockfile
39+
- name: Use dependency cache
40+
uses: actions/cache@v3
41+
id: cache
42+
with:
43+
path: "**/node_modules"
44+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
45+
- name: Install dependencies
46+
run: yarn --frozen-lockfile --ignore-engines
47+
if: steps.cache.outputs.cache-hit != 'true'
3248
- run: yarn check:types
3349

3450
formatting-check:
@@ -39,7 +55,15 @@ jobs:
3955
- uses: actions/setup-node@v3
4056
with:
4157
node-version-file: "package.json"
42-
- run: yarn --frozen-lockfile
58+
- name: Use dependency cache
59+
uses: actions/cache@v3
60+
id: cache
61+
with:
62+
path: "**/node_modules"
63+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
64+
- name: Install dependencies
65+
run: yarn --frozen-lockfile --ignore-engines
66+
if: steps.cache.outputs.cache-hit != 'true'
4367
- run: yarn check:formatting
4468

4569
test-unit:
@@ -51,7 +75,15 @@ jobs:
5175
- uses: actions/setup-node@v3
5276
with:
5377
node-version-file: "package.json"
54-
- run: yarn --frozen-lockfile
78+
- name: Use dependency cache
79+
uses: actions/cache@v3
80+
id: cache
81+
with:
82+
path: "**/node_modules"
83+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
84+
- name: Install dependencies
85+
run: yarn --frozen-lockfile --ignore-engines
86+
if: steps.cache.outputs.cache-hit != 'true'
5587
- run: yarn test:unit
5688

5789
test-integration:
@@ -76,8 +108,15 @@ jobs:
76108
- uses: actions/setup-node@v3
77109
with:
78110
node-version: ${{ matrix.node-version }}
79-
# husky uses fs-extra which needs node >= 14 - we can ignore because its a dev dependency
80-
- run: yarn --frozen-lockfile --ignore-engines
111+
- name: Use dependency cache
112+
uses: actions/cache@v3
113+
id: cache
114+
with:
115+
path: "**/node_modules"
116+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
117+
- name: Install dependencies
118+
run: yarn --frozen-lockfile --ignore-engines
119+
if: steps.cache.outputs.cache-hit != 'true'
81120
- run: yarn test:integration
82121

83122
test-e2e:
@@ -95,7 +134,15 @@ jobs:
95134
steps:
96135
- uses: actions/checkout@v3
97136
- uses: volta-cli/action@v3
98-
- run: yarn --frozen-lockfile
137+
- name: Use dependency cache
138+
uses: actions/cache@v3
139+
id: cache
140+
with:
141+
path: "**/node_modules"
142+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
143+
- name: Install dependencies
144+
run: yarn --frozen-lockfile --ignore-engines
145+
if: steps.cache.outputs.cache-hit != 'true'
99146
- run: yarn test:e2e
100147

101148
lint:
@@ -107,7 +154,15 @@ jobs:
107154
- uses: actions/setup-node@v3
108155
with:
109156
node-version-file: "package.json"
110-
- run: yarn --frozen-lockfile
157+
- name: Use dependency cache
158+
uses: actions/cache@v3
159+
id: cache
160+
with:
161+
path: "**/node_modules"
162+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
163+
- name: Install dependencies
164+
run: yarn --frozen-lockfile --ignore-engines
165+
if: steps.cache.outputs.cache-hit != 'true'
111166
- run: yarn lint
112167

113168
artifacts:
@@ -121,7 +176,8 @@ jobs:
121176
- uses: actions/setup-node@v3
122177
with:
123178
node-version-file: "package.json"
124-
- run: yarn --frozen-lockfile
179+
- name: Install dependencies
180+
run: yarn --frozen-lockfile
125181
- name: pack
126182
run: yarn build:npm
127183
- name: archive artifacts

0 commit comments

Comments
 (0)