Skip to content

Commit 849f519

Browse files
authored
Add GH actions yarn cache (#1881)
1 parent accc2b4 commit 849f519

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.github/workflows/pr-any.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ jobs:
1414
uses: actions/setup-node@v1
1515
with:
1616
node-version: ${{ matrix.node-version }}
17+
- name: Config yarn cache
18+
id: yarn-cache-dir-path
19+
run: echo "::set-output name=dir::$(yarn cache dir)"
20+
- uses: actions/cache@v1
21+
id: yarn-cache
22+
with:
23+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
24+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
25+
restore-keys: |
26+
${{ runner.os }}-yarn-
1727
- name: lint
1828
run: |
1929
yarn install --frozen-lockfile
@@ -31,6 +41,16 @@ jobs:
3141
uses: actions/setup-node@v1
3242
with:
3343
node-version: ${{ matrix.node-version }}
44+
- name: Config yarn cache
45+
id: yarn-cache-dir-path
46+
run: echo "::set-output name=dir::$(yarn cache dir)"
47+
- uses: actions/cache@v1
48+
id: yarn-cache
49+
with:
50+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
51+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
52+
restore-keys: |
53+
${{ runner.os }}-yarn-
3454
- name: test
3555
run: |
3656
yarn install --frozen-lockfile
@@ -48,6 +68,16 @@ jobs:
4868
uses: actions/setup-node@v1
4969
with:
5070
node-version: ${{ matrix.node-version }}
71+
- name: Config yarn cache
72+
id: yarn-cache-dir-path
73+
run: echo "::set-output name=dir::$(yarn cache dir)"
74+
- uses: actions/cache@v1
75+
id: yarn-cache
76+
with:
77+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
78+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
79+
restore-keys: |
80+
${{ runner.os }}-yarn-
5181
- name: build
5282
run: |
5383
yarn install --frozen-lockfile
@@ -65,6 +95,16 @@ jobs:
6595
uses: actions/setup-node@v1
6696
with:
6797
node-version: ${{ matrix.node-version }}
98+
- name: Config yarn cache
99+
id: yarn-cache-dir-path
100+
run: echo "::set-output name=dir::$(yarn cache dir)"
101+
- uses: actions/cache@v1
102+
id: yarn-cache
103+
with:
104+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
105+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
106+
restore-keys: |
107+
${{ runner.os }}-yarn-
68108
- name: build
69109
run: |
70110
yarn install --frozen-lockfile

.github/workflows/push-master.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ jobs:
2020
uses: actions/setup-node@v1
2121
with:
2222
node-version: ${{ matrix.node-version }}
23+
- name: Config yarn cache
24+
id: yarn-cache-dir-path
25+
run: echo "::set-output name=dir::$(yarn cache dir)"
26+
- uses: actions/cache@v1
27+
id: yarn-cache
28+
with:
29+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
30+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-yarn-
2333
- name: build
2434
env:
2535
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
@@ -44,6 +54,16 @@ jobs:
4454
uses: actions/setup-node@v1
4555
with:
4656
node-version: ${{ matrix.node-version }}
57+
- name: Config yarn cache
58+
id: yarn-cache-dir-path
59+
run: echo "::set-output name=dir::$(yarn cache dir)"
60+
- uses: actions/cache@v1
61+
id: yarn-cache
62+
with:
63+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
64+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
65+
restore-keys: |
66+
${{ runner.os }}-yarn-
4767
- name: build
4868
env:
4969
GH_PAT: ${{ secrets.GH_PAT }}

0 commit comments

Comments
 (0)