Skip to content
Draft
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
67 changes: 67 additions & 0 deletions .github/workflows/build_andorid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Android Build Test (Fast)

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-android:
runs-on: ubuntu-latest
timeout-minutes: 25

steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9.14.4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

# 如果 android/ 文件夹已存在,可跳过 prebuild
- name: Prebuild Android project
run: |
if [ ! -f "android/gradlew" ]; then
echo "🧩 No gradlew found, running expo prebuild..."
pnpm expo prebuild --platform android --non-interactive --no-install
else
echo "✅ gradlew exists, skip prebuild."
fi
env:
EXPO_NO_DOCTOR: 1

- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Set up Gradle
run: |
cd android
chmod +x gradlew

- name: Build Android Debug APK
run: |
cd android
./gradlew assembleDebug --no-daemon --parallel --build-cache --configure-on-demand
env:
CI: true

- name: Notify on failure
if: failure()
run: echo "❌ Android build failed. Please check the logs above."
76 changes: 76 additions & 0 deletions .github/workflows/build_ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: iOS Build Test (Fast)

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-ios:
runs-on: macos-14 # M2 runner,比 Intel 快很多
timeout-minutes: 40

steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9.14.4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

# ⚡️ 跳过 prebuild(你已有 ios 文件夹)
- name: Prebuild iOS project (only if needed)
run: |
if [ ! -f ios/Podfile ]; then
echo "🧩 No Podfile found, running expo prebuild..."
pnpm expo prebuild --platform ios --non-interactive --no-install
else
echo "✅ Podfile exists, skip prebuild."
fi
env:
EXPO_NO_DOCTOR: 1

- name: Cache CocoaPods & DerivedData
uses: actions/cache@v3
with:
path: |
ios/Pods
~/Library/Caches/CocoaPods
~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- name: Install CocoaPods
run: |
cd ios
pod install --silent

- name: Build iOS app (Release)
run: |
cd ios
xcodebuild \
-workspace ccnubox.xcworkspace \
-scheme ccnubox \
-configuration Release \
-sdk iphonesimulator \
-derivedDataPath build \
-quiet \
-parallelizeTargets \
-UseNewBuildSystem=YES
env:
CI: true

- name: Notify on failure
if: failure()
run: echo "❌ iOS build failed. Please check the logs above."
Loading