mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-02-07 17:02:29 +01:00
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:
parent
6508e171db
commit
2f48519dce
10
.github/workflows/build_linux.yaml
vendored
10
.github/workflows/build_linux.yaml
vendored
@ -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:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
@ -16,19 +19,21 @@ jobs:
|
|||||||
name: webapp
|
name: webapp
|
||||||
|
|
||||||
- name: Cache .hak
|
- name: Cache .hak
|
||||||
|
id: cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: ${{ hashFiles('./yarn.lock') }}
|
key: ${{ runner.os }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
|
||||||
path: |
|
path: |
|
||||||
./.hak
|
./.hak
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
|
||||||
- name: Install libsqlcipher-dev
|
- name: Install libsqlcipher-dev
|
||||||
if: inputs.sqlcipher == 'system'
|
if: steps.cache.outputs.cache-hit != 'true' && inputs.sqlcipher == 'system'
|
||||||
run: sudo apt-get install -y libsqlcipher-dev
|
run: sudo apt-get install -y libsqlcipher-dev
|
||||||
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -40,6 +45,7 @@ jobs:
|
|||||||
run: "yarn install --pure-lockfile"
|
run: "yarn install --pure-lockfile"
|
||||||
|
|
||||||
- name: Build Natives
|
- name: Build Natives
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: "yarn build:native"
|
run: "yarn build:native"
|
||||||
env:
|
env:
|
||||||
SQLCIPHER_STATIC: ${{ inputs.sqlcipher == 'static' && '1' || '' }}
|
SQLCIPHER_STATIC: ${{ inputs.sqlcipher == 'static' && '1' || '' }}
|
||||||
|
8
.github/workflows/build_macos.yaml
vendored
8
.github/workflows/build_macos.yaml
vendored
@ -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:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
jobs:
|
jobs:
|
||||||
@ -11,13 +14,15 @@ jobs:
|
|||||||
name: webapp
|
name: webapp
|
||||||
|
|
||||||
- name: Cache .hak
|
- name: Cache .hak
|
||||||
|
id: cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: ${{ hashFiles('./yarn.lock') }}
|
key: ${{ runner.os }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
|
||||||
path: |
|
path: |
|
||||||
./.hak
|
./.hak
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
@ -32,6 +37,7 @@ jobs:
|
|||||||
run: "yarn install --pure-lockfile"
|
run: "yarn install --pure-lockfile"
|
||||||
|
|
||||||
- name: Build Natives
|
- name: Build Natives
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: "yarn build:native:universal"
|
run: "yarn build:native:universal"
|
||||||
|
|
||||||
- name: Build App
|
- name: Build App
|
||||||
|
8
.github/workflows/build_prepare.yaml
vendored
8
.github/workflows/build_prepare.yaml
vendored
@ -26,6 +26,12 @@ jobs:
|
|||||||
- name: Fetch Element Web
|
- name: Fetch Element Web
|
||||||
run: yarn run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
|
run: yarn run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
|
||||||
|
|
||||||
|
# We split this out to save the build_* scripts having to do it to make use of `hashFiles` in the cache action
|
||||||
|
- name: Generate cache hash files
|
||||||
|
run: |
|
||||||
|
yarn run --silent electron --version > electronVersion
|
||||||
|
cat package.json | jq -c .hakDependencies > hakDependencies.json
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: webapp
|
name: webapp
|
||||||
@ -33,3 +39,5 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
webapp.asar
|
webapp.asar
|
||||||
package.json
|
package.json
|
||||||
|
electronVersion
|
||||||
|
hakDependencies.json
|
||||||
|
8
.github/workflows/build_windows.yaml
vendored
8
.github/workflows/build_windows.yaml
vendored
@ -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:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
@ -32,9 +35,10 @@ jobs:
|
|||||||
name: webapp
|
name: webapp
|
||||||
|
|
||||||
- name: Cache .hak
|
- name: Cache .hak
|
||||||
|
id: cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: ${{ runner.os }}-${{ hashFiles('./yarn.lock') }}
|
key: ${{ runner.os }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
|
||||||
path: |
|
path: |
|
||||||
./.hak
|
./.hak
|
||||||
|
|
||||||
@ -58,6 +62,7 @@ jobs:
|
|||||||
echo "C:/Program Files/NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
echo "C:/Program Files/NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
@ -72,6 +77,7 @@ jobs:
|
|||||||
run: "yarn install --pure-lockfile"
|
run: "yarn install --pure-lockfile"
|
||||||
|
|
||||||
- name: Build Natives
|
- name: Build Natives
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
refreshenv
|
refreshenv
|
||||||
yarn build:native --target ${{ steps.config.outputs.target }}
|
yarn build:native --target ${{ steps.config.outputs.target }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user