|
| 1 | +name: Mobile Build Benchmark |
| 2 | + |
| 3 | +# Throwaway benchmark: times the store build profiles with `eas build --local` |
| 4 | +# on Blacksmith runners, to compare against EAS's cloud builders. Nothing is |
| 5 | +# submitted, and the benchmark profiles never bump the remote build number. |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - .github/workflows/mobile-build-benchmark.yml |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + android: |
| 17 | + name: Android ${{ matrix.runner }} |
| 18 | + if: github.repository == 'pingdotgg/t3code' |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + runner: [blacksmith-16vcpu-ubuntu-2404, blacksmith-32vcpu-ubuntu-2404] |
| 23 | + runs-on: ${{ matrix.runner }} |
| 24 | + timeout-minutes: 90 |
| 25 | + env: |
| 26 | + APP_VARIANT: production |
| 27 | + NODE_OPTIONS: --max-old-space-size=8192 |
| 28 | + EXPO_TOKEN: ${{ secrets.EXPO_PRODUCTION_TOKEN }} |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v6 |
| 32 | + with: |
| 33 | + fetch-depth: 0 |
| 34 | + |
| 35 | + - name: Setup Vite+ |
| 36 | + uses: voidzero-dev/setup-vp@v1 |
| 37 | + with: |
| 38 | + node-version-file: package.json |
| 39 | + cache: true |
| 40 | + run-install: | |
| 41 | + args: |
| 42 | + - --filter=@t3tools/mobile... |
| 43 | +
|
| 44 | + - name: Expose pnpm |
| 45 | + run: | |
| 46 | + pnpm_version="$(node --print "require('./package.json').packageManager.split('@').pop()")" |
| 47 | + echo "$HOME/.vite-plus/package_manager/pnpm/$pnpm_version/pnpm/bin" >> "$GITHUB_PATH" |
| 48 | +
|
| 49 | + - name: Setup Java |
| 50 | + uses: actions/setup-java@v4 |
| 51 | + with: |
| 52 | + distribution: zulu |
| 53 | + java-version: "17" |
| 54 | + |
| 55 | + - name: Setup EAS |
| 56 | + uses: expo/expo-github-action@v8 |
| 57 | + with: |
| 58 | + eas-version: latest |
| 59 | + token: ${{ secrets.EXPO_PRODUCTION_TOKEN }} |
| 60 | + packager: npm |
| 61 | + |
| 62 | + - name: Pull production environment variables |
| 63 | + working-directory: apps/mobile |
| 64 | + run: | |
| 65 | + eas env:pull production --non-interactive |
| 66 | + node --input-type=module <<'NODE' |
| 67 | + import { appendFileSync, readFileSync } from "node:fs"; |
| 68 | + import { parseEnv } from "node:util"; |
| 69 | + const env = parseEnv(readFileSync(".env.local", "utf8")); |
| 70 | + appendFileSync(process.env.GITHUB_ENV, `T3CODE_ANDROID_GOOGLE_SERVICES_FILE=${env.T3CODE_ANDROID_GOOGLE_SERVICES_FILE}\n`); |
| 71 | + NODE |
| 72 | +
|
| 73 | + - name: Machine |
| 74 | + run: | |
| 75 | + nproc |
| 76 | + free -g |
| 77 | + echo "ANDROID_HOME=$ANDROID_HOME" |
| 78 | +
|
| 79 | + - name: Build (eas build --local, benchmark profile) |
| 80 | + working-directory: apps/mobile |
| 81 | + run: | |
| 82 | + start=$(date +%s) |
| 83 | + eas build --local --platform android --profile benchmark --non-interactive --output "$RUNNER_TEMP/t3code.aab" |
| 84 | + echo "### Android ${{ matrix.runner }}: $(( ($(date +%s) - start) / 60 )) min $(( ($(date +%s) - start) % 60 )) s" >> "$GITHUB_STEP_SUMMARY" |
| 85 | +
|
| 86 | + ios: |
| 87 | + name: iOS ${{ matrix.runner }} |
| 88 | + if: github.repository == 'pingdotgg/t3code' |
| 89 | + strategy: |
| 90 | + fail-fast: false |
| 91 | + matrix: |
| 92 | + runner: [blacksmith-12vcpu-macos-26] |
| 93 | + runs-on: ${{ matrix.runner }} |
| 94 | + timeout-minutes: 90 |
| 95 | + env: |
| 96 | + APP_VARIANT: production |
| 97 | + NODE_OPTIONS: --max-old-space-size=8192 |
| 98 | + EXPO_TOKEN: ${{ secrets.EXPO_PRODUCTION_TOKEN }} |
| 99 | + steps: |
| 100 | + - name: Checkout |
| 101 | + uses: actions/checkout@v6 |
| 102 | + with: |
| 103 | + fetch-depth: 0 |
| 104 | + |
| 105 | + - name: Select Xcode 27.1 |
| 106 | + run: | |
| 107 | + ls -d /Applications/Xcode*.app |
| 108 | + xcode=$(ls -d /Applications/Xcode_27.1*.app /Applications/Xcode-27.1*.app 2>/dev/null | head -1) |
| 109 | + if [ -z "$xcode" ]; then |
| 110 | + echo "::warning::Xcode 27.1 not found; EAS uses 27.1. Falling back to the newest Xcode." |
| 111 | + xcode=$(ls -d /Applications/Xcode*.app | sort -V | tail -1) |
| 112 | + fi |
| 113 | + sudo xcode-select -s "$xcode/Contents/Developer" |
| 114 | + xcodebuild -version |
| 115 | + sysctl -n hw.ncpu machdep.cpu.brand_string |
| 116 | + echo "$(( $(sysctl -n hw.memsize) / 1073741824 )) GB" |
| 117 | +
|
| 118 | + - name: Setup Vite+ |
| 119 | + uses: voidzero-dev/setup-vp@v1 |
| 120 | + with: |
| 121 | + node-version-file: package.json |
| 122 | + cache: true |
| 123 | + run-install: | |
| 124 | + args: |
| 125 | + - --filter=@t3tools/mobile... |
| 126 | +
|
| 127 | + - name: Expose pnpm |
| 128 | + run: | |
| 129 | + pnpm_version="$(node --print "require('./package.json').packageManager.split('@').pop()")" |
| 130 | + echo "$HOME/.vite-plus/package_manager/pnpm/$pnpm_version/pnpm/bin" >> "$GITHUB_PATH" |
| 131 | +
|
| 132 | + - name: Setup EAS |
| 133 | + uses: expo/expo-github-action@v8 |
| 134 | + with: |
| 135 | + eas-version: latest |
| 136 | + token: ${{ secrets.EXPO_PRODUCTION_TOKEN }} |
| 137 | + packager: npm |
| 138 | + |
| 139 | + - name: Build tools |
| 140 | + run: | |
| 141 | + command -v pod || sudo gem install cocoapods --no-document |
| 142 | + command -v fastlane || brew install fastlane |
| 143 | + pod --version |
| 144 | + fastlane --version | tail -1 |
| 145 | +
|
| 146 | + - name: Pull production environment variables |
| 147 | + working-directory: apps/mobile |
| 148 | + run: eas env:pull production --non-interactive |
| 149 | + |
| 150 | + - name: Build (eas build --local, benchmark-ios profile) |
| 151 | + working-directory: apps/mobile |
| 152 | + run: | |
| 153 | + start=$(date +%s) |
| 154 | + eas build --local --platform ios --profile benchmark-ios --non-interactive --output "$RUNNER_TEMP/t3code.ipa" |
| 155 | + echo "### iOS ${{ matrix.runner }}: $(( ($(date +%s) - start) / 60 )) min $(( ($(date +%s) - start) % 60 )) s" >> "$GITHUB_STEP_SUMMARY" |
0 commit comments