Update build scripts (#1404)
This commit is contained in:
@@ -59,11 +59,11 @@ jobs:
|
||||
- name: Install CocoaPods
|
||||
run: sudo gem install cocoapods
|
||||
|
||||
- name: Build core libraries (including iOS Rust)
|
||||
- name: Build core libraries for iOS
|
||||
run: |
|
||||
cd ../../core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
./build-and-distribute.sh --ios
|
||||
|
||||
- name: Verify core library distribution
|
||||
run: |
|
||||
@@ -89,29 +89,34 @@ jobs:
|
||||
cd ios
|
||||
pod install
|
||||
|
||||
- name: Install .NET workloads
|
||||
working-directory: apps/server
|
||||
run: dotnet workload install wasm-tools
|
||||
|
||||
- name: Build API server
|
||||
working-directory: apps/server
|
||||
run: dotnet build AliasVault.Api
|
||||
|
||||
- name: Start PostgreSQL
|
||||
run: |
|
||||
brew services start postgresql@14
|
||||
# Install and start PostgreSQL
|
||||
brew install postgresql@17
|
||||
brew services start postgresql@17
|
||||
|
||||
# Add PostgreSQL to PATH
|
||||
echo "/opt/homebrew/opt/postgresql@17/bin" >> $GITHUB_PATH
|
||||
export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH"
|
||||
|
||||
# Wait for PostgreSQL to be ready
|
||||
for i in {1..10}; do
|
||||
if pg_isready -h localhost; then
|
||||
for i in {1..15}; do
|
||||
if /opt/homebrew/opt/postgresql@17/bin/pg_isready -h localhost; then
|
||||
echo "PostgreSQL is ready!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting for PostgreSQL... attempt $i"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Create database and user
|
||||
createuser -s aliasvault || true
|
||||
psql postgres -c "ALTER USER aliasvault WITH PASSWORD 'password';" || true
|
||||
createdb -O aliasvault aliasdb_e2e_ios || true
|
||||
/opt/homebrew/opt/postgresql@17/bin/createuser -s aliasvault || true
|
||||
/opt/homebrew/opt/postgresql@17/bin/psql postgres -c "ALTER USER aliasvault WITH PASSWORD 'password';" || true
|
||||
/opt/homebrew/opt/postgresql@17/bin/createdb -O aliasvault aliasdb_e2e_ios || true
|
||||
|
||||
- name: Start API server
|
||||
working-directory: apps/server/AliasVault.Api
|
||||
@@ -120,7 +125,7 @@ jobs:
|
||||
# Wait for API to be ready
|
||||
echo "Waiting for API to start..."
|
||||
for i in {1..30}; do
|
||||
if curl -s http://localhost:5092/v1/Auth/status > /dev/null 2>&1; then
|
||||
if curl -s http://localhost:5092/v1/ > /dev/null 2>&1; then
|
||||
echo "API is ready!"
|
||||
break
|
||||
fi
|
||||
@@ -134,6 +139,8 @@ jobs:
|
||||
PUBLIC_REGISTRATION_ENABLED: "true"
|
||||
ADMIN_PASSWORD_HASH: "AQAAAAIAAYagAAAAEKWfKfa2gh9Z72vjAlnNP1xlME7FsunRznzyrfqFte40FToufRwa3kX8wwDwnEXZag=="
|
||||
ADMIN_PASSWORD_GENERATED: "2024-01-01T00:00:00Z"
|
||||
# Bind to all interfaces (IPv4 and IPv6)
|
||||
ASPNETCORE_URLS: "http://0.0.0.0:5092"
|
||||
|
||||
- name: Boot iOS Simulator
|
||||
run: |
|
||||
@@ -160,8 +167,33 @@ jobs:
|
||||
|
||||
echo "Booting simulator: $SIMULATOR_ID"
|
||||
xcrun simctl boot "$SIMULATOR_ID" || true
|
||||
|
||||
# Wait for simulator to be fully booted
|
||||
echo "Waiting for simulator to be ready..."
|
||||
xcrun simctl bootstatus "$SIMULATOR_ID" -b
|
||||
|
||||
echo "SIMULATOR_ID=$SIMULATOR_ID" >> $GITHUB_ENV
|
||||
|
||||
- name: Start Metro bundler
|
||||
run: |
|
||||
# Start Metro bundler in background (non-interactive mode for CI)
|
||||
npx expo start --offline > /tmp/metro.log 2>&1 &
|
||||
METRO_PID=$!
|
||||
echo $METRO_PID > /tmp/metro.pid
|
||||
|
||||
# Wait for Metro to be ready
|
||||
echo "Waiting for Metro bundler to start..."
|
||||
for i in {1..30}; do
|
||||
if curl -s http://localhost:8081/status 2>/dev/null | grep -q "packager-status:running"; then
|
||||
echo "Metro bundler is ready!"
|
||||
break
|
||||
fi
|
||||
echo "Attempt $i: Metro not ready yet..."
|
||||
# Show recent log for debugging
|
||||
tail -3 /tmp/metro.log 2>/dev/null || true
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: Build iOS app for testing
|
||||
run: |
|
||||
cd ios
|
||||
@@ -187,12 +219,28 @@ jobs:
|
||||
-derivedDataPath build \
|
||||
-only-testing:AliasVaultUITests \
|
||||
-resultBundlePath TestResults.xcresult \
|
||||
-parallel-testing-enabled NO \
|
||||
-maximum-concurrent-test-simulator-destinations 1 \
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
IDEFileSystemSynchronizedGroupsAreEnabled=NO
|
||||
env:
|
||||
API_URL: "http://localhost:5092"
|
||||
IDEFileSystemSynchronizedGroupsAreEnabled: NO
|
||||
|
||||
- name: Extract attachments from xcresult
|
||||
if: always()
|
||||
run: |
|
||||
mkdir -p /tmp/test-attachments
|
||||
# Extract all attachments from the xcresult bundle
|
||||
if [ -d "ios/TestResults.xcresult" ]; then
|
||||
xcrun xcresulttool get --path ios/TestResults.xcresult --format json > /tmp/test-attachments/results.json 2>/dev/null || true
|
||||
# Export attachments
|
||||
xcrun xcresulttool export --path ios/TestResults.xcresult --output-path /tmp/test-attachments --type file 2>/dev/null || true
|
||||
# List what we found
|
||||
echo "Attachments found:"
|
||||
ls -la /tmp/test-attachments/ || true
|
||||
fi
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -201,12 +249,22 @@ jobs:
|
||||
path: apps/mobile-app/ios/TestResults.xcresult
|
||||
retention-days: 14
|
||||
|
||||
- name: Upload screenshots on failure
|
||||
- name: Upload extracted attachments
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-ui-test-attachments
|
||||
path: /tmp/test-attachments/
|
||||
retention-days: 14
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Upload logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-ui-test-screenshots
|
||||
name: ios-ui-test-logs
|
||||
path: |
|
||||
apps/mobile-app/ios/build/Logs/Test/**/*.png
|
||||
apps/mobile-app/ios/build/Logs/Test/**/*.jpg
|
||||
/tmp/api-server.log
|
||||
/tmp/metro.log
|
||||
retention-days: 14
|
||||
if-no-files-found: ignore
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { browser } from 'wxt/browser';
|
||||
|
||||
import type { TokenModel, LoginResponse, BadRequestResponse } from '@/utils/dist/core/models/webapi';
|
||||
|
||||
import initWasm, {
|
||||
srpGenerateSalt,
|
||||
srpDerivePrivateKey,
|
||||
@@ -7,9 +9,6 @@ import initWasm, {
|
||||
srpGenerateEphemeral,
|
||||
srpDeriveSession,
|
||||
} from '../dist/core/rust/aliasvault_core.js';
|
||||
|
||||
import type { TokenModel, LoginResponse, BadRequestResponse } from '@/utils/dist/core/models/webapi';
|
||||
|
||||
import { EncryptionUtility } from '../EncryptionUtility';
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ declare const __DEV__: boolean;
|
||||
* - mobile-unlock/[requestId] - Mobile device unlock via QR code
|
||||
* - __debug__/set-offline/[true|false] - (DEV only) Toggle offline mode for E2E testing
|
||||
* - __debug__/set-api-url/[encoded-url] - (DEV only) Set API URL for E2E testing
|
||||
* - __debug__/set-server-revision/[number] - (DEV only) Set local server revision for RPO testing
|
||||
*
|
||||
* This route exists to handle deep links that Expo Router processes before our
|
||||
* Linking.addEventListener can intercept them. It provides proper navigation
|
||||
@@ -62,7 +63,11 @@ export default function ActionHandler() : null {
|
||||
break;
|
||||
}
|
||||
|
||||
// Debug actions for E2E testing (only work in dev mode)
|
||||
/**
|
||||
* ----------------------------------------------------------------------------
|
||||
* Debug actions for E2E testing (only works in dev mode)
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
case '__debug__': {
|
||||
if (!__DEV__) {
|
||||
console.warn('[ActionHandler] Debug actions only available in development');
|
||||
@@ -91,9 +96,11 @@ export default function ActionHandler() : null {
|
||||
}
|
||||
|
||||
case 'set-api-url': {
|
||||
// Set API URL: aliasvault://open/__debug__/set-api-url/http%3A%2F%2Flocalhost%3A5092
|
||||
// Note: If slashes in URL aren't encoded, they become separate path segments
|
||||
// So we join all remaining params with '/' to reconstruct the URL
|
||||
/*
|
||||
* Set API URL: aliasvault://open/__debug__/set-api-url/http%3A%2F%2Flocalhost%3A5092
|
||||
* Note: If slashes in URL aren't encoded, they become separate path segments
|
||||
* So we join all remaining params with '/' to reconstruct the URL
|
||||
*/
|
||||
if (debugParams.length === 0) {
|
||||
console.error('[ActionHandler] set-api-url requires URL parameter');
|
||||
router.replace('/(tabs)/items');
|
||||
|
||||
@@ -878,7 +878,20 @@ final class AliasVaultUITests: XCTestCase {
|
||||
}
|
||||
|
||||
if !screenFound {
|
||||
print("[Helper] Warning: No expected screen found after \(maxWaitTime)s, proceeding anyway")
|
||||
// Capture screenshot and app hierarchy for debugging
|
||||
let screenshot = XCUIScreen.main.screenshot()
|
||||
let attachment = XCTAttachment(screenshot: screenshot)
|
||||
attachment.name = "FAILURE-no-screen-found"
|
||||
attachment.lifetime = .keepAlways
|
||||
add(attachment)
|
||||
|
||||
let hierarchyAttachment = XCTAttachment(string: app.debugDescription)
|
||||
hierarchyAttachment.name = "FAILURE-hierarchy-no-screen-found"
|
||||
hierarchyAttachment.lifetime = .keepAlways
|
||||
add(hierarchyAttachment)
|
||||
|
||||
XCTFail("No expected screen (login, unlock, or items) found after \(maxWaitTime)s. App may have crashed or failed to load.")
|
||||
return
|
||||
}
|
||||
|
||||
// Handle unlock screen - logout to start fresh with test user
|
||||
|
||||
@@ -7,6 +7,7 @@ set -u # Treat unset variables as errors
|
||||
BUILD_ALL=false
|
||||
BUILD_BROWSER=false
|
||||
BUILD_DOTNET=false
|
||||
BUILD_IOS=false
|
||||
BUILD_ANDROID=false
|
||||
BUILD_COMMON=true # Always build TypeScript utils, models, and vault
|
||||
|
||||
@@ -21,6 +22,10 @@ while [[ $# -gt 0 ]]; do
|
||||
BUILD_DOTNET=true
|
||||
shift
|
||||
;;
|
||||
--ios)
|
||||
BUILD_IOS=true
|
||||
shift
|
||||
;;
|
||||
--android)
|
||||
BUILD_ANDROID=true
|
||||
shift
|
||||
@@ -29,6 +34,7 @@ while [[ $# -gt 0 ]]; do
|
||||
BUILD_BROWSER=true
|
||||
BUILD_DOTNET=true
|
||||
BUILD_ANDROID=true
|
||||
# Note: iOS excluded from --all as it requires macOS/Xcode (use --ios explicitly)
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
@@ -37,13 +43,14 @@ while [[ $# -gt 0 ]]; do
|
||||
echo "Target options:"
|
||||
echo " --browser Build WASM for browser extension and Blazor WASM client"
|
||||
echo " --dotnet Build native library for .NET server-side use"
|
||||
echo " --ios Build for iOS with Swift bindings"
|
||||
echo " --android Build for Android with Kotlin bindings"
|
||||
echo " --all Build all targets (browser, dotnet, android)"
|
||||
echo " --all Build cross-platform targets (browser, dotnet, android)"
|
||||
echo ""
|
||||
echo "Notes:"
|
||||
echo " - TypeScript utilities, models, and vault are always built"
|
||||
echo " - iOS builds are handled by Xcode build phases, not this script"
|
||||
echo " - If no target is specified, all targets are built"
|
||||
echo " - iOS requires macOS/Xcode, use --ios explicitly (not included in --all)"
|
||||
echo " - If no target is specified, cross-platform targets are built"
|
||||
echo ""
|
||||
exit 0
|
||||
;;
|
||||
@@ -55,9 +62,9 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# If no targets specified, build all
|
||||
if ! $BUILD_BROWSER && ! $BUILD_DOTNET && ! $BUILD_ANDROID; then
|
||||
echo "No target specified, building all targets..."
|
||||
# If no targets specified, build cross-platform targets (iOS excluded - requires macOS)
|
||||
if ! $BUILD_BROWSER && ! $BUILD_DOTNET && ! $BUILD_IOS && ! $BUILD_ANDROID; then
|
||||
echo "No target specified, building cross-platform targets..."
|
||||
BUILD_BROWSER=true
|
||||
BUILD_DOTNET=true
|
||||
BUILD_ANDROID=true
|
||||
@@ -98,7 +105,7 @@ if $BUILD_COMMON; then
|
||||
fi
|
||||
|
||||
# Rust core build (optional - requires Rust toolchain)
|
||||
if $BUILD_BROWSER || $BUILD_DOTNET || $BUILD_ANDROID; then
|
||||
if $BUILD_BROWSER || $BUILD_DOTNET || $BUILD_IOS || $BUILD_ANDROID; then
|
||||
cd ./rust
|
||||
|
||||
if command -v rustc &> /dev/null; then
|
||||
@@ -109,6 +116,11 @@ if $BUILD_BROWSER || $BUILD_DOTNET || $BUILD_ANDROID; then
|
||||
./build.sh --android
|
||||
fi
|
||||
|
||||
if $BUILD_IOS; then
|
||||
echo " → Building for iOS..."
|
||||
./build.sh --ios
|
||||
fi
|
||||
|
||||
if $BUILD_BROWSER; then
|
||||
echo " → Building for Browser/WASM..."
|
||||
./build.sh --browser
|
||||
|
||||
Reference in New Issue
Block a user