Skip to content

Commit 2a40759

Browse files
committed
ci(code-check): add cache for dependencies
1 parent 8128b3d commit 2a40759

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/code-check.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@ jobs:
2424
node-version: 20
2525
cache: pnpm
2626

27+
- name: Cache dependencies
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.pnpm-store
31+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
32+
2733
- name: Install dependencies
2834
run: pnpm install
2935

3036
lint:
37+
needs: setup
3138
runs-on: ubuntu-latest
3239
steps:
3340
- name: Checkout
@@ -43,10 +50,18 @@ jobs:
4350
with:
4451
node-version: 20
4552
cache: pnpm
53+
54+
- name: Restore cached dependencies
55+
uses: actions/cache@v2
56+
with:
57+
path: ~/.pnpm-store
58+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
59+
4660
- name: Lint Check
4761
run: pnpm lint
4862

4963
type-check:
64+
needs: setup
5065
runs-on: ubuntu-latest
5166
steps:
5267
- name: Checkout
@@ -57,6 +72,12 @@ jobs:
5772
with:
5873
version: 8.15.4
5974

75+
- name: Cache dependencies
76+
uses: actions/cache@v2
77+
with:
78+
path: ~/.pnpm-store
79+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
80+
6081
- name: Setup Node
6182
uses: actions/setup-node@v4
6283
with:
@@ -66,6 +87,7 @@ jobs:
6687
run: pnpm typecheck
6788

6889
unit-test:
90+
needs: setup
6991
runs-on: ubuntu-latest
7092
steps:
7193
- name: Checkout
@@ -81,10 +103,18 @@ jobs:
81103
with:
82104
node-version: 20
83105
cache: pnpm
106+
107+
- name: Cache dependencies
108+
uses: actions/cache@v2
109+
with:
110+
path: ~/.pnpm-store
111+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
112+
84113
- name: Unit Test
85114
run: pnpm test
86115

87116
build:
117+
needs: setup
88118
runs-on: ubuntu-latest
89119
steps:
90120
- name: Checkout
@@ -100,5 +130,12 @@ jobs:
100130
with:
101131
node-version: 20
102132
cache: pnpm
133+
134+
- name: Cache dependencies
135+
uses: actions/cache@v2
136+
with:
137+
path: ~/.pnpm-store
138+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
139+
103140
- name: Build
104141
run: pnpm build

0 commit comments

Comments
 (0)