Skip to content

Commit ab2f9fe

Browse files
authored
Cache the APK and WASM builds (#81)
The APK and WASM gallery are rebuilt on any CI run. This caches the results and only rebuilds if the gallery and/or ui source files change.
1 parent 4b0efc3 commit ab2f9fe

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/workflows/apk_gallery.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v4
25+
- name: Cache APK build
26+
id: cache-apk
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
target/release/apk/slint_material.apk
31+
key: apk-build-${{ hashFiles('examples/gallery/**', 'ui/**', 'Cargo.toml', 'material.slint', 'crate/**') }}
2532
- name: Install Android API level 30
2633
run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-30"
2734
- name: Install Rust
@@ -48,6 +55,7 @@ jobs:
4855
mkdir -p /home/runner/.android
4956
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > $CARGO_APK_RELEASE_KEYSTORE
5057
- name: Build
58+
if: steps.cache-apk.outputs.cache-hit != 'true'
5159
working-directory: examples/gallery
5260
run: cargo apk build --target aarch64-linux-android --lib --release
5361
- name: "Upload Artifacts"

.github/workflows/wasm_gallery.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18+
- name: Cache WASM build
19+
id: cache-wasm
20+
uses: actions/cache@v4
21+
with:
22+
path: |
23+
examples/gallery/pkg
24+
examples/gallery/index.html
25+
examples/gallery/frame-tablet.webp
26+
key: wasm-build-${{ hashFiles('examples/gallery/**', 'ui/**', 'Cargo.toml', 'material.slint', 'crate/**') }}
1827
- name: Install Rust
1928
uses: dtolnay/rust-toolchain@stable
2029
with:
@@ -25,6 +34,7 @@ jobs:
2534
with:
2635
key: wasm-build
2736
- name: Build
37+
if: steps.cache-wasm.outputs.cache-hit != 'true'
2838
working-directory: examples/gallery
2939
run: wasm-pack build --target web
3040
- name: "Upload Artifacts"

0 commit comments

Comments
 (0)