Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/actions/build-android-app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Build Android app
description: Build an Android demo app from this monorepo (with optional Expo prebuild)

inputs:
app-path:
description: Path to the app workspace, relative to the repo root (e.g. apps/llm)
required: true
expo-prebuild:
description: Whether to run `expo prebuild --platform android` before the Gradle build
required: false
default: "true"
filter-name:
description: dorny/paths-filter filter name for this app+platform (e.g. llm-android). Used as the content-hash cache key so a previously-passing build can be skipped if nothing relevant has changed.
required: true

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: "yarn"

- name: Install root dependencies
shell: bash
run: yarn install --immutable

- name: Compute build hash
id: hash
shell: bash
run: |
h=$(node scripts/compute-app-hash.js "${{ inputs.filter-name }}")
echo "key=build-${{ inputs.filter-name }}-$h" >> "$GITHUB_OUTPUT"

- name: Lookup pass marker
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/ci-marker
key: ${{ steps.hash.outputs.key }}
lookup-only: true

- name: Skip notice
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: echo "Skipping build — ${{ inputs.filter-name }} already passed at this content hash."

- name: Free disk space
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker system prune -af

- name: Setup Java 17
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: 17
cache: "gradle"

- name: Install Expo CLI
if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true'
shell: bash
run: |
npm install -g @expo/cli
echo "$(npm prefix -g)/bin" >> $GITHUB_PATH

- name: Generate native Android project
if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true'
working-directory: ${{ inputs.app-path }}
shell: bash
run: |
rm -rf android
npx expo prebuild --platform android --no-install

- name: Cache Gradle
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
${{ inputs.app-path }}/android/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build app
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ inputs.app-path }}/android
shell: bash
run: |
./gradlew assembleDebug \
--build-cache \
--parallel \
--daemon \
--configure-on-demand \
-PreactNativeArchitectures=arm64-v8a \
-Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError" \
-Dorg.gradle.workers.max=4

- name: Save pass marker
if: steps.cache.outputs.cache-hit != 'true' && success()
shell: bash
run: |
mkdir -p "${{ runner.temp }}/ci-marker"
touch "${{ runner.temp }}/ci-marker/passed"

- name: Cache pass marker
if: steps.cache.outputs.cache-hit != 'true' && success()
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/ci-marker
key: ${{ steps.hash.outputs.key }}
118 changes: 118 additions & 0 deletions .github/actions/build-ios-app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Build iOS app
description: Build an iOS demo app from this monorepo (with optional Expo prebuild)

inputs:
app-path:
description: Path to the app workspace, relative to the repo root (e.g. apps/llm)
required: true
expo-prebuild:
description: Whether to run `expo prebuild --platform ios` before pod install
required: false
default: "true"
filter-name:
description: dorny/paths-filter filter name for this app+platform (e.g. llm-ios). Used as the content-hash cache key so a previously-passing build can be skipped if nothing relevant has changed.
required: true

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: "yarn"

- name: Install root dependencies
shell: bash
run: yarn install --immutable

- name: Compute build hash
id: hash
shell: bash
run: |
h=$(node scripts/compute-app-hash.js "${{ inputs.filter-name }}")
echo "key=build-${{ inputs.filter-name }}-$h" >> "$GITHUB_OUTPUT"

- name: Lookup pass marker
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/ci-marker
key: ${{ steps.hash.outputs.key }}
lookup-only: true

- name: Skip notice
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: echo "Skipping build — ${{ inputs.filter-name }} already passed at this content hash."

- name: Setup Xcode
if: steps.cache.outputs.cache-hit != 'true'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Install Expo CLI
if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true'
shell: bash
run: |
npm install -g @expo/cli
echo "$(npm prefix -g)/bin" >> $GITHUB_PATH

- name: Generate native iOS project
if: steps.cache.outputs.cache-hit != 'true' && inputs.expo-prebuild == 'true'
working-directory: ${{ inputs.app-path }}
shell: bash
run: |
rm -rf ios
npx expo prebuild --platform ios --no-install

- name: Cache CocoaPods
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: |
~/Library/Caches/CocoaPods
${{ inputs.app-path }}/ios/Pods
key: ${{ runner.os }}-pods-${{ inputs.filter-name }}-${{ hashFiles(format('{0}/ios/Podfile.lock', inputs.app-path)) }}
restore-keys: |
${{ runner.os }}-pods-${{ inputs.filter-name }}-

- name: Install CocoaPods dependencies
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ inputs.app-path }}/ios
shell: bash
run: pod install

- name: Build app
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ inputs.app-path }}/ios
shell: bash
run: |
WORKSPACE=$(ls -d *.xcworkspace | head -n 1)
SCHEME="${WORKSPACE%.xcworkspace}"
set -o pipefail && xcodebuild \
-workspace "$WORKSPACE" \
-scheme "$SCHEME" \
-sdk iphonesimulator \
-configuration Debug \
-destination 'generic/platform=iOS Simulator' \
build \
CODE_SIGNING_ALLOWED=NO \
-jobs $(sysctl -n hw.ncpu) \
COMPILER_INDEX_STORE_ENABLE=NO \
ONLY_ACTIVE_ARCH=YES | xcbeautify

- name: Save pass marker
if: steps.cache.outputs.cache-hit != 'true' && success()
shell: bash
run: |
mkdir -p "${{ runner.temp }}/ci-marker"
touch "${{ runner.temp }}/ci-marker/passed"

- name: Cache pass marker
if: steps.cache.outputs.cache-hit != 'true' && success()
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/ci-marker
key: ${{ steps.hash.outputs.key }}
79 changes: 0 additions & 79 deletions .github/workflows/build-android-llm-example.yml

This file was deleted.

Loading
Loading