Skip to content

use new architecture and JSI for native calls to nim #63

use new architecture and JSI for native calls to nim

use new architecture and JSI for native calls to nim #63

Workflow file for this run

name: Build Android
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build-android:
name: Build Android APK
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Enable Corepack for Yarn
run: |
corepack enable
cd mobile-app
corepack use yarn@4.9.4
- name: Install dependencies
working-directory: mobile-app
run: yarn install --immutable
- name: Setup Nim
run: |
# Install build essentials and C compiler
sudo apt-get update
sudo apt-get install -y build-essential curl
# Download and install prebuilt Nim binaries
cd /tmp
curl -L -o nim.tar.xz "https://nim-lang.org/download/nim-2.0.8-linux_x64.tar.xz"
tar -xf nim.tar.xz
sudo mv nim-2.0.8 /opt/nim
# Add to PATH
echo "/opt/nim/bin" >> $GITHUB_PATH
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
export PATH="/opt/nim/bin:$HOME/.nimble/bin:$PATH"
# Verify installation
nim --version
nimble --version
- name: Install Nim dependencies
working-directory: mobile-app/nim
run: |
if [ -f "nimbridge.nimble" ]; then
nimble install -d
fi
- name: Build Nim code for Android
working-directory: mobile-app
run: |
# Run the build script to compile Nim for Android
chmod +x tools/build-mobile.sh
./tools/build-mobile.sh
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
- name: Clear Metro cache
working-directory: mobile-app
run: |
echo "" | yarn react-native clean
rm -rf node_modules/.cache || true
rm -rf /tmp/metro-* || true
- name: Grant execute permission for gradlew
run: chmod +x mobile-app/android/gradlew
- name: Debug - Check codegen setup
working-directory: mobile-app
run: |
echo "=== Checking nim-bridge module configuration ==="
cat modules/nim-bridge/package.json | grep -A 10 "codegenConfig" || echo "No codegenConfig found"
echo ""
echo "=== Checking if NativeNimBridge.ts exists ==="
ls -la modules/nim-bridge/src/NativeNimBridge.ts || echo "NativeNimBridge.ts not found"
echo ""
echo "=== Checking gradle.properties for new architecture ==="
cat android/gradle.properties | grep -i "newarch\|fabric\|turbo" || echo "No new architecture flags found"
- name: Build Release APK
working-directory: mobile-app/android
env:
NODE_ENV: production
EXPO_USE_FAST_RESOLVER: 1
run: ./gradlew assembleRelease --no-daemon --no-build-cache --info --stacktrace
- name: Debug - Check codegen output
if: always()
working-directory: mobile-app
run: |
echo "=== Checking if codegen directory was created ==="
ls -la modules/nim-bridge/android/build/generated/source/ || echo "No generated/source directory"
echo ""
echo "=== Looking for any codegen artifacts ==="
find modules/nim-bridge/android/build -name "*codegen*" -o -name "*Spec*" || echo "No codegen artifacts found"
echo ""
echo "=== Checking app codegen output ==="
ls -la android/app/build/generated/source/codegen/ || echo "No app codegen output"
- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: app-release
path: mobile-app/android/app/build/outputs/apk/release/app-release.apk
retention-days: 7
- name: Stop Gradle daemon
if: always()
working-directory: mobile-app/android
run: ./gradlew --stop