feat(FN-1093): add mobile build, PWA, and live reload workflow
- Optimize dashboard Vite output for mobile and include vite/client types in app typecheck - Add PWA support with manifest, service worker, icons, and client registration hooks - Add a mobile workspace package with Capacitor config and live-reload scripts for local development - Add a dedicated GitHub Actions mobile pipeline and update mobile workflow documentation - Add dashboard tests for build output, mobile scripts, and PWA asset coverage
This commit is contained in:
218
.github/workflows/mobile.yml
vendored
Normal file
218
.github/workflows/mobile.yml
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
name: Mobile Builds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "packages/mobile/**"
|
||||
- "packages/dashboard/**"
|
||||
- ".github/workflows/mobile.yml"
|
||||
|
||||
jobs:
|
||||
build-web:
|
||||
name: Build web bundle
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: pnpm
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build dashboard client
|
||||
run: pnpm --filter @fusion/dashboard build
|
||||
|
||||
- name: Upload dashboard dist artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dashboard-dist-client
|
||||
path: packages/dashboard/dist/client
|
||||
retention-days: 30
|
||||
|
||||
build-ios:
|
||||
name: Build iOS artifact
|
||||
runs-on: macos-latest
|
||||
needs: build-web
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: pnpm
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Cache iOS DerivedData
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/Library/Developer/Xcode/DerivedData
|
||||
key: ${{ runner.os }}-derived-data-${{ hashFiles('packages/mobile/**', 'pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-derived-data-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Download dashboard artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dashboard-dist-client
|
||||
path: packages/dashboard/dist/client
|
||||
|
||||
- name: Check iOS platform directory
|
||||
id: ios-check
|
||||
run: |
|
||||
if [ -d packages/mobile/ios ]; then
|
||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "::notice::Platform directory not found, skipping native build"
|
||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Sync Capacitor iOS project
|
||||
if: steps.ios-check.outputs.exists == 'true'
|
||||
run: pnpm --filter @fusion/mobile cap sync ios
|
||||
|
||||
- name: Build unsigned IPA
|
||||
if: steps.ios-check.outputs.exists == 'true'
|
||||
run: |
|
||||
xcodebuild \
|
||||
-workspace packages/mobile/ios/App/App.xcworkspace \
|
||||
-scheme App \
|
||||
-configuration Debug \
|
||||
-sdk iphoneos \
|
||||
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
build
|
||||
|
||||
APP_PATH="$(find "$RUNNER_TEMP/DerivedData" -name App.app -type d | head -n 1)"
|
||||
if [ -z "$APP_PATH" ]; then
|
||||
echo "::error::Unable to locate built App.app"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$RUNNER_TEMP/ios-artifacts/Payload"
|
||||
cp -R "$APP_PATH" "$RUNNER_TEMP/ios-artifacts/Payload/App.app"
|
||||
(
|
||||
cd "$RUNNER_TEMP/ios-artifacts"
|
||||
zip -r fusion-ios.ipa Payload
|
||||
)
|
||||
|
||||
- name: Upload iOS artifact
|
||||
if: steps.ios-check.outputs.exists == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fusion-ios-ipa
|
||||
path: ${{ runner.temp }}/ios-artifacts/fusion-ios.ipa
|
||||
retention-days: 30
|
||||
|
||||
build-android:
|
||||
name: Build Android artifact
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-web
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: pnpm
|
||||
|
||||
- name: Setup Java 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "17"
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Cache Android Gradle caches
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('packages/mobile/android/**/*.gradle*', 'packages/mobile/android/**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Download dashboard artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dashboard-dist-client
|
||||
path: packages/dashboard/dist/client
|
||||
|
||||
- name: Check Android platform directory
|
||||
id: android-check
|
||||
run: |
|
||||
if [ -d packages/mobile/android ]; then
|
||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "::notice::Platform directory not found, skipping native build"
|
||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Sync Capacitor Android project
|
||||
if: steps.android-check.outputs.exists == 'true'
|
||||
run: pnpm --filter @fusion/mobile cap sync android
|
||||
|
||||
- name: Build APK
|
||||
if: steps.android-check.outputs.exists == 'true'
|
||||
run: |
|
||||
cd packages/mobile/android
|
||||
chmod +x gradlew
|
||||
./gradlew assembleDebug
|
||||
|
||||
- name: Upload Android artifact
|
||||
if: steps.android-check.outputs.exists == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fusion-android-apk
|
||||
path: packages/mobile/android/app/build/outputs/apk/debug/*.apk
|
||||
retention-days: 30
|
||||
Reference in New Issue
Block a user