Skip to content

Commit 29e0530

Browse files
ci: add optimizations
1 parent 1af1cb3 commit 29e0530

File tree

2 files changed

+67
-6
lines changed

2 files changed

+67
-6
lines changed

.github/workflows/build-android-llm-example.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,50 @@ jobs:
3333
node-version: '18'
3434
cache: 'yarn'
3535
- name: Setup Java 17
36-
uses: actions/setup-java@v3
36+
uses: actions/setup-java@v4
3737
with:
3838
distribution: 'zulu'
3939
java-version: 17
40+
cache: 'gradle'
4041
- name: Install root dependencies
4142
run: yarn install --immutable
4243
- name: Install Expo CLI
4344
run: |
4445
npm install -g @expo/cli
4546
echo "$(npm prefix -g)/bin" >> $GITHUB_PATH
47+
- name: Cache Expo prebuild
48+
uses: actions/cache@v4
49+
with:
50+
path: ${{ env.WORKING_DIRECTORY }}/android
51+
key: ${{ runner.os }}-expo-android-${{ hashFiles('${{ env.WORKING_DIRECTORY }}/app.json', '${{ env.WORKING_DIRECTORY }}/package.json') }}
52+
restore-keys: |
53+
${{ runner.os }}-expo-android-
4654
- name: Generate native Android project
4755
working-directory: ${{ env.WORKING_DIRECTORY }}
48-
run: npx expo prebuild --platform android --no-install
56+
run: |
57+
if [ ! -d "android" ]; then
58+
npx expo prebuild --platform android --no-install
59+
else
60+
echo "Android project exists, skipping prebuild"
61+
fi
62+
- name: Cache Gradle
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
~/.gradle/caches
67+
~/.gradle/wrapper
68+
${{ env.WORKING_DIRECTORY }}/android/.gradle
69+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
70+
restore-keys: |
71+
${{ runner.os }}-gradle-
4972
- name: Build app
5073
working-directory: ${{ env.WORKING_DIRECTORY }}/android
51-
run: ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a
74+
run: |
75+
./gradlew assembleDebug \
76+
--build-cache \
77+
--parallel \
78+
--daemon \
79+
--configure-on-demand \
80+
-PreactNativeArchitectures=arm64-v8a \
81+
-Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError" \
82+
-Dorg.gradle.workers.max=4

.github/workflows/build-ios-llm-example.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,39 @@ jobs:
4141
run: |
4242
npm install -g @expo/cli
4343
echo "$(npm prefix -g)/bin" >> $GITHUB_PATH
44+
- name: Cache Expo prebuild
45+
uses: actions/cache@v4
46+
with:
47+
path: apps/llm/ios
48+
key: ${{ runner.os }}-expo-ios-${{ hashFiles('apps/llm/app.json', 'apps/llm/package.json') }}
49+
restore-keys: |
50+
${{ runner.os }}-expo-ios-
4451
- name: Generate native iOS project
4552
working-directory: apps/llm
46-
run: npx expo prebuild --platform ios --no-install
53+
run: |
54+
if [ ! -d "ios" ]; then
55+
npx expo prebuild --platform ios --no-install
56+
else
57+
echo "iOS project exists, skipping prebuild"
58+
fi
59+
- name: Cache CocoaPods
60+
uses: actions/cache@v4
61+
with:
62+
path: |
63+
apps/llm/ios/Pods
64+
~/Library/Caches/CocoaPods
65+
~/.cocoapods
66+
key: ${{ runner.os }}-pods-${{ hashFiles('apps/llm/ios/Podfile.lock') }}
67+
restore-keys: |
68+
${{ runner.os }}-pods-
4769
- name: Install CocoaPods dependencies
4870
working-directory: apps/llm/ios
49-
run: pod install
71+
run: |
72+
if [ ! -d "Pods" ]; then
73+
pod install
74+
else
75+
echo "Pods directory exists, skipping install"
76+
fi
5077
- name: Build app
5178
working-directory: apps/llm/ios
5279
run: |
@@ -57,4 +84,7 @@ jobs:
5784
-configuration Debug \
5885
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
5986
build \
60-
CODE_SIGNING_ALLOWED=NO | xcbeautify
87+
CODE_SIGNING_ALLOWED=NO \
88+
-jobs $(sysctl -n hw.ncpu) \
89+
COMPILER_INDEX_STORE_ENABLE=NO \
90+
ONLY_ACTIVE_ARCH=YES | xcbeautify

0 commit comments

Comments
 (0)