mirror of
https://github.com/selfxyz/self.git
synced 2026-02-19 02:24:25 -05:00
* chore: update CI workflows to include Java setup and modify runner environments - Added Java installation checks and setup steps to multiple CI workflows to ensure Java is available for builds. - Changed runner environments for iOS builds from `macos-latest-large` to `namespace-profile-apple-silicon-6cpu` for better resource management. - Updated push triggers for CI workflows to include specific branches and paths for more controlled execution. * refactor: streamline AES-GCM encryption tag validation in encryptAES256GCM function - Removed redundant checks for the AES-GCM authentication tag, simplifying the code while maintaining functionality. - Updated the return structure to directly convert the authentication tag to a binary format, enhancing clarity and efficiency. * chore: add Actionlint configuration for custom runner labels * chore: update mobile deployment workflows for testing configuration * chore: included a step to set the INSTALL_JAVA environment variable to false * chore: update logging in setup-native-source script for improved debugging * chore: simplify mobile CI workflow by removing redundant iOS and Android build steps - Removed extensive iOS and Android build steps from the mobile CI workflow, as build verification is now handled by the mobile-e2e.yml workflow. * chore: update mobile workflows to remove push triggers for improved clarity - Removed push triggers from mobile CI, E2E, and bundle analysis workflows to streamline execution and focus on pull request events. - This change enhances workflow clarity and reduces unnecessary runs on branch pushes. * Revert "chore: simplify mobile CI workflow by removing redundant iOS and Android build steps" This reverts commit 30d5f585c2e7d74355452d4a4a2bd809c378c983. * Updated the conditions for running iOS and Android build jobs to only trigger on workflow dispatch events, reducing unnecessary executions. * chore: enhance mobile CI workflows with push triggers for improved execution control - Added push triggers for dev, staging, and main branches in mobile bundle analysis, E2E, and demo E2E workflows to ensure builds are triggered on relevant changes. - Included conditions for running iOS E2E tests based on issue comments, allowing for more flexible testing workflows. * Addind workflow_dispatch option * chore: refine mobile E2E workflows by removing issue comment triggers - Eliminated issue comment event triggers from mobile E2E workflows to streamline execution and focus on workflow dispatch and push events. - This change enhances clarity and reduces unnecessary complexity in the CI process. * chore: remove checkout action from npm publish workflow - Eliminated the checkout action from the npm publish workflow to streamline the process and reduce unnecessary steps. - This change aims to enhance the efficiency of the CI pipeline.
111 lines
4.3 KiB
Bash
Executable File
111 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# SPDX-FileCopyrightText: 2025 Social Connect Labs, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
# NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE.
|
|
|
|
# Build Android AAR from source using the app's Gradle wrapper
|
|
|
|
set -e
|
|
|
|
echo "🤖 Building Android AAR for mobile-sdk-alpha..."
|
|
|
|
# Navigate to SDK directory
|
|
SDK_DIR="$(dirname "$0")/.."
|
|
cd "$SDK_DIR"
|
|
|
|
# Ensure dist/android directory exists
|
|
mkdir -p dist/android
|
|
|
|
# Check if native modules source is available
|
|
MOBILE_SDK_NATIVE="mobile-sdk-native"
|
|
|
|
echo "🔍 Checking for Android build options..."
|
|
|
|
if [ -d "$MOBILE_SDK_NATIVE" ]; then
|
|
echo "✅ Native modules source submodule found, building from source..."
|
|
|
|
# Check if we already have a valid AAR file
|
|
if [ -f "dist/android/mobile-sdk-alpha-release.aar" ]; then
|
|
echo "🔍 AAR file found, validating contents..."
|
|
|
|
# Check file size first (should be at least 100KB for a valid AAR)
|
|
AAR_SIZE=$(stat -f%z "dist/android/mobile-sdk-alpha-release.aar" 2>/dev/null || stat -c%s "dist/android/mobile-sdk-alpha-release.aar" 2>/dev/null)
|
|
|
|
if [ "$AAR_SIZE" -gt 100000 ]; then
|
|
# Extract classes.jar to temp file and check for required classes
|
|
TEMP_JAR=$(mktemp)
|
|
if unzip -p "dist/android/mobile-sdk-alpha-release.aar" classes.jar > "$TEMP_JAR" 2>/dev/null && \
|
|
jar tf "$TEMP_JAR" 2>/dev/null | grep -q "com/selfxyz/selfSDK/RNSelfPassportReaderModule.class"; then
|
|
rm -f "$TEMP_JAR"
|
|
echo "✅ AAR is valid ($(numfmt --to=iec-i --suffix=B $AAR_SIZE 2>/dev/null || echo "${AAR_SIZE} bytes")), skipping build"
|
|
echo "📦 Using existing AAR: dist/android/mobile-sdk-alpha-release.aar"
|
|
exit 0
|
|
else
|
|
rm -f "$TEMP_JAR"
|
|
echo "⚠️ AAR is missing required classes (RNSelfPassportReaderModule)"
|
|
fi
|
|
else
|
|
echo "⚠️ AAR file is too small (${AAR_SIZE} bytes), likely incomplete"
|
|
fi
|
|
|
|
echo "🔄 Removing invalid AAR and rebuilding..."
|
|
rm -f "dist/android/mobile-sdk-alpha-release.aar"
|
|
fi
|
|
|
|
# Setup and update submodule using the setup script
|
|
echo "🔄 Setting up and updating submodule..."
|
|
node scripts/setup-native-source.cjs
|
|
|
|
# Navigate to android directory
|
|
cd android
|
|
|
|
# Check if we're in a monorepo and can use the app's gradlew
|
|
APP_GRADLEW="../../../app/android/gradlew"
|
|
|
|
if [ -f "$APP_GRADLEW" ]; then
|
|
echo "✅ Using app's Gradle wrapper"
|
|
|
|
# Copy source from submodule if available
|
|
if [ -d "../$MOBILE_SDK_NATIVE/src" ]; then
|
|
echo "📝 Copying source from submodule to android directory..."
|
|
rm -rf src
|
|
cp -r "../$MOBILE_SDK_NATIVE/src" .
|
|
fi
|
|
|
|
if [ -d "../$MOBILE_SDK_NATIVE/libs" ]; then
|
|
echo "📝 Copying libs from submodule to android directory..."
|
|
rm -rf libs
|
|
cp -r "../$MOBILE_SDK_NATIVE/libs" .
|
|
fi
|
|
|
|
# Build using app's gradlew from the app's android directory
|
|
# This ensures React Native and other dependencies are available
|
|
cd ../../../app/android
|
|
./gradlew :mobile-sdk-alpha:assembleRelease
|
|
|
|
echo "✅ Android AAR built successfully from submodule source"
|
|
echo "📦 AAR location: packages/mobile-sdk-alpha/dist/android/"
|
|
echo "💡 Changes in mobile-sdk-native/ are tracked with git history"
|
|
else
|
|
echo "❌ Error: Could not find app's Gradle wrapper at $APP_GRADLEW"
|
|
echo "Please ensure you're running this from the monorepo root or that the app is set up."
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "⚠️ Private source not found, checking for prebuilt AAR..."
|
|
|
|
# Check if prebuilt AAR already exists
|
|
if [ -f "dist/android/mobile-sdk-alpha-release.aar" ]; then
|
|
echo "✅ Prebuilt AAR found: dist/android/mobile-sdk-alpha-release.aar"
|
|
echo "📦 Using existing prebuilt AAR"
|
|
else
|
|
echo "❌ No prebuilt AAR found at dist/android/mobile-sdk-alpha-release.aar"
|
|
echo "💡 To build from source, clone the mobile-sdk-native repository:"
|
|
echo " node scripts/setup-native-source.cjs"
|
|
echo " yarn build:android"
|
|
echo ""
|
|
echo "⚠️ Package may not work without AAR file!"
|
|
exit 1
|
|
fi
|
|
fi
|