68 lines
1.3 KiB
Bash
Executable File
68 lines
1.3 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
|
|
|
|
#Remove Delivered data
|
|
rm -rf ~/Library/Developer/Xcode/DerivedData
|
|
|
|
#Generate xcodeproj file
|
|
$(dirname "$0")/generate.swift --path=iOS/project-sym.yml
|
|
|
|
if [ "$?" != "0" ]; then
|
|
echo >&2 "⛔️ Error: xcodeproj generation failed";
|
|
exit 1
|
|
fi
|
|
|
|
|
|
cd $IOS_PATH
|
|
|
|
APPLICATION_NAME=PrivadoVPN
|
|
SCHEME=PrivadoVPN
|
|
|
|
DERIVED_PATH=$ROOT/DERIVED
|
|
|
|
#Remove old results
|
|
rm -rf $DERIVED_PATH
|
|
rm -rf $ARCHIVE_PATH
|
|
|
|
mkdir $DERIVED_PATH
|
|
|
|
unlock_login_keychain "$K8S_SECRET_JARVIS"
|
|
|
|
#Test
|
|
xcodebuild -project $APPLICATION_NAME.xcodeproj \
|
|
-scheme $SCHEME \
|
|
-sdk iphonesimulator \
|
|
-destination 'platform=iOS Simulator,name=iPhone 13 Pro' \
|
|
-enableCodeCoverage YES \
|
|
ENABLE_SWIFTLINT=NO \
|
|
build \
|
|
test | xcpretty
|
|
|
|
if [ "${PIPESTATUS[0]}" != "0" ]; then
|
|
echo >&2 "⛔️ Error: Test failed";
|
|
exit 1
|
|
fi
|
|
|
|
# Clean after
|
|
|
|
rm -rf $ARCHIVE_PATH
|