Improve build time in CI through caching native modules (#482)

* Improve caching of hak native modules

* Avoid double-hashing

* Skip native installs where cache is hit

* Include Electron version in the hash, it affects the ABI

* Add missing step IDs

* Add comments
This commit is contained in:
Michael Telatynski
2022-12-13 14:12:40 +00:00
committed by GitHub
parent 6508e171db
commit 2f48519dce
4 changed files with 30 additions and 4 deletions

View File

@@ -1,3 +1,6 @@
# This workflow relies on actions/cache to store the hak dependency artifacts as they take a long time to build
# Due to this extra care must be taken to only ever run all build_* scripts against the same branch to ensure
# the correct cache scoping, and additional care must be taken to not run untrusted actions on the develop branch.
on:
workflow_call:
jobs:
@@ -11,13 +14,15 @@ jobs:
name: webapp
- name: Cache .hak
id: cache
uses: actions/cache@v3
with:
key: ${{ hashFiles('./yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
path: |
./.hak
- name: Install Rust
if: steps.cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
@@ -32,6 +37,7 @@ jobs:
run: "yarn install --pure-lockfile"
- name: Build Natives
if: steps.cache.outputs.cache-hit != 'true'
run: "yarn build:native:universal"
- name: Build App