Skip to content

Commit 5ac56ad

Browse files
committed
fix(ci): cache ipfs-webui
This should stabilize CI by reducing the umber of times we fetch the same version of ipfs-webui.
1 parent fcbde1b commit 5ac56ad

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

Diff for: .github/workflows/ci.yml

+52-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,52 @@ env:
88

99
jobs:
1010

11+
webui:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out Git repository
15+
uses: actions/checkout@v2
16+
17+
- name: Install Node.js
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: 'lts/*'
21+
22+
- name: Cache webui
23+
uses: actions/cache@v2
24+
id: webui-cache
25+
with:
26+
path: assets/webui
27+
key: ${{ hashFiles('package.json') }} # webui CID is defined in this file
28+
29+
- name: Cache bigger downloads
30+
uses: actions/cache@v2
31+
id: cache
32+
if: steps.webui-cache.outputs.cache-hit != 'true'
33+
with:
34+
path: ${{ github.workspace }}/.cache
35+
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
36+
restore-keys: |
37+
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
38+
${{ runner.os }}-
39+
40+
- name: Install dependencies and fetch ipfs-webui
41+
if: steps.webui-cache.outputs.cache-hit != 'true'
42+
run: |
43+
npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
44+
npm run clean
45+
npm run webui
46+
47+
- name: Attach cached ipfs-webui to Github Action
48+
uses: actions/upload-artifact@v2
49+
with:
50+
name: ipfs-webui
51+
path: assets/webui
52+
if-no-files-found: error
53+
1154
test:
1255
runs-on: ${{ matrix.os }}
56+
needs: webui
1357
strategy:
1458
fail-fast: false
1559
matrix:
@@ -22,7 +66,14 @@ jobs:
2266
- name: Install Node.js
2367
uses: actions/setup-node@v2
2468
with:
25-
node-version: '14'
69+
node-version: 'lts/*'
70+
71+
- name: Cache webui
72+
uses: actions/cache@v2
73+
id: webui-cache
74+
with:
75+
path: assets/webui
76+
key: ${{ hashFiles('package.json') }}
2677

2778
- name: Cache bigger downloads
2879
uses: actions/cache@v2

0 commit comments

Comments
 (0)