69 lines
1.6 KiB
Bash
Executable File
69 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
unlock_login_keychain() {
|
|
if [ -z "$1" ]; then
|
|
echo "Password parameter must be exists"
|
|
return 1
|
|
fi
|
|
local timeout=3600
|
|
if [ -n "$2" ]; then
|
|
timeout=$2
|
|
fi
|
|
|
|
security list-keychains -s ~/Library/Keychains/login.keychain-db
|
|
security unlock-keychain -p $1 ~/Library/Keychains/login.keychain-db
|
|
security set-keychain-settings -t $timeout -l ~/Library/Keychains/login.keychain-db
|
|
}
|
|
|
|
#Passed external variables
|
|
|
|
ROOT=$(pwd)
|
|
IOS_PATH=$ROOT/iOS
|
|
DERIVED_PATH=$ROOT/TEST_DERIVED
|
|
|
|
#Remove old results
|
|
rm -rf $DERIVED_PATH
|
|
|
|
mkdir $DERIVED_PATH
|
|
|
|
#Generate xcodeproj file
|
|
$(dirname "$0")/generate.swift --path=iOS/project.yml --type="BETA"
|
|
|
|
if [ "$?" != "0" ]; then
|
|
echo >&2 "⛔️ Error: xcodeproj generation failed";
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Generate xcodeproj complete"
|
|
|
|
# Copy Package.resolved fr force build on build machine
|
|
echo "🥠 Copy Package.resolved to Malinka.xcodeproj"
|
|
mkdir -p $IOS_PATH/Malinka.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
|
|
cp -f $ROOT/toolchain/Package.resolved $IOS_PATH/Malinka.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
|
|
|
|
cd $IOS_PATH
|
|
|
|
# Build app
|
|
|
|
xcodebuild -project ./Malinka.xcodeproj \
|
|
-scheme Malinka \
|
|
-destination 'platform=iOS Simulator,name=iPhone 14 Pro' \
|
|
build | xcpretty
|
|
|
|
# Run tests
|
|
|
|
xcodebuild -project ./Malinka.xcodeproj \
|
|
-scheme Malinka \
|
|
-destination 'platform=iOS Simulator,name=iPhone 14 Pro' \
|
|
test | xcpretty
|
|
|
|
if [ "${PIPESTATUS[0]}" != "0" ]; then
|
|
echo >&2 "⛔️ Error: Test failed";
|
|
rm -rf $DERIVED_PATH
|
|
exit 1
|
|
fi
|
|
|
|
# Clean after
|
|
rm -rf $DERIVED_PATH
|
|
|