Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): cache ipfs-webui #1913

Merged
merged 1 commit into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 60 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,52 @@ env:

jobs:

webui:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 'lts/*'

- name: Cache webui
uses: actions/cache@v2
id: webui-cache
with:
path: assets/webui
key: ${{ hashFiles('package.json') }} # webui CID is defined in this file

- name: Cache bigger downloads
uses: actions/cache@v2
id: cache
if: steps.webui-cache.outputs.cache-hit != 'true'
with:
path: ${{ github.workspace }}/.cache
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'electron-builder.yml') }}
${{ runner.os }}-

- name: Install dependencies and fetch ipfs-webui
if: steps.webui-cache.outputs.cache-hit != 'true'
run: |
npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
npm run clean
npm run force-webui-download

- name: Attach cached ipfs-webui to Github Action
uses: actions/upload-artifact@v2
with:
name: ipfs-webui
path: assets/webui
if-no-files-found: error

test:
runs-on: ${{ matrix.os }}
needs: webui
strategy:
fail-fast: false
matrix:
Expand All @@ -22,7 +66,14 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: 'lts/*'

- name: Cache webui
uses: actions/cache@v2
id: webui-cache
with:
path: assets/webui
key: ${{ hashFiles('package.json') }}

- name: Cache bigger downloads
uses: actions/cache@v2
Expand Down Expand Up @@ -67,7 +118,14 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: 'lts/*'

- name: Cache webui
uses: actions/cache@v2
id: webui-cache
with:
path: assets/webui
key: ${{ hashFiles('package.json') }}

- name: Cache bigger downloads
uses: actions/cache@v2
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"test:e2e": "xvfb-maybe cross-env NODE_ENV=test LIBP2P_ALLOW_WEAK_RSA_KEYS=1 mocha test/e2e/**/*.e2e.js --exit",
"postinstall": "run-s install-app-deps",
"install-app-deps": "electron-builder install-app-deps",
"clean": "shx rm -rf assets/webui/ node_modules/go-ipfs/bin",
"clean": "shx rm -rf node_modules/go-ipfs/bin",
"force-webui-download": "shx rm -rf assets/webui && run-s build:webui",
"build": "run-s clean build:webui",
"build:webui": "run-s build:webui:*",
"build:webui:download": "npx ipfs-or-gateway -c bafybeihcyruaeza7uyjd6ugicbcrqumejf6uf353e5etdkhotqffwtguva -p assets/webui/ -t 360000 --verbose --clean",
"build:webui:download": "npx ipfs-or-gateway -c bafybeihcyruaeza7uyjd6ugicbcrqumejf6uf353e5etdkhotqffwtguva -p assets/webui/ -t 360000 --verbose",
"build:webui:minimize": "shx rm -rf assets/webui/static/js/*.map && shx rm -rf assets/webui/static/css/*.map",
"package": "shx rm -rf dist/ && run-s build && electron-builder --publish onTag"
},
Expand Down