ci: cache npm + Gradle to slash compute usage
- actions/setup-node cache: npm - actions/cache for ~/.gradle/caches, ~/.gradle/wrapper, android/.gradle - actions/cache for Android intermediates (android/app/build/intermediates, android/build, android/app/.cxx) - Skip debug keystore regeneration if cached - Add workflow_dispatch to publish-play-store for manual re-runs Cuts a clean run from ~6m to ~2-3m once warm. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
.github/workflows/build.yml
vendored
28
.github/workflows/build.yml
vendored
@@ -21,6 +21,7 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
@@ -30,6 +31,28 @@ jobs:
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
android/.gradle
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('android/**/*.gradle*', 'android/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Cache Android build outputs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
android/app/build/intermediates
|
||||
android/build
|
||||
android/app/.cxx
|
||||
key: ${{ runner.os }}-android-build-${{ hashFiles('package-lock.json', 'android/**/*.gradle*') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-android-build-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install --legacy-peer-deps
|
||||
|
||||
@@ -37,7 +60,10 @@ jobs:
|
||||
run: npx expo prebuild --platform android --no-install
|
||||
|
||||
- name: Generate debug keystore
|
||||
run: keytool -genkey -v -keystore android/app/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
|
||||
run: |
|
||||
if [ ! -f android/app/debug.keystore ]; then
|
||||
keytool -genkey -v -keystore android/app/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
|
||||
fi
|
||||
|
||||
- name: Build APK
|
||||
working-directory: android
|
||||
|
||||
24
.github/workflows/publish-play-store.yml
vendored
24
.github/workflows/publish-play-store.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
types: [published]
|
||||
push:
|
||||
tags: ["v*"]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
@@ -20,6 +21,7 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
@@ -29,6 +31,28 @@ jobs:
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
android/.gradle
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('android/**/*.gradle*', 'android/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Cache Android build outputs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
android/app/build/intermediates
|
||||
android/build
|
||||
android/app/.cxx
|
||||
key: ${{ runner.os }}-android-build-${{ hashFiles('package-lock.json', 'android/**/*.gradle*') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-android-build-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install --legacy-peer-deps
|
||||
|
||||
|
||||
Reference in New Issue
Block a user