-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got iOS, macOS, Android working for .NET test server (#81)
* Got iOS and macOS working for .NET test server Android is moved but not working fully yet. I cannot test as I don't have a proper Android device. * Add iOS teardown and use lockable resource * Lock android device as well * Fix mistaken Jenkinsfile and add .NET Android pwsh should be shell outside of Windows * Fix up iOS things that make Jenkins annoyed
- Loading branch information
Showing
29 changed files
with
423 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dotnet-install.ps1 | ||
prepare_dotnet.psm1 | ||
prepare_dotnet.psm1 | ||
prepare_dotnet.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source $SCRIPT_DIR/prepare_env.sh | ||
|
||
banner "Executing build for .NET $DOTNET_VERSION Android" | ||
|
||
pushd $SCRIPT_DIR/../../../servers/dotnet/testserver | ||
$HOME/.dotnet/dotnet publish -f net$DOTNET_VERSION-android -v n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source $SCRIPT_DIR/prepare_env.sh | ||
|
||
banner "Executing build for .NET $DOTNET_VERSION iOS" | ||
|
||
export DEVELOPER_DIR="/Applications/Xcode-16.1.0.app/" | ||
export MD_APPLE_SDK_ROOT=$DEVELOPER_DIR | ||
pushd $SCRIPT_DIR/../../../servers/dotnet/testserver | ||
security unlock-keychain -p $KEYCHAIN_PASSWORD | ||
$HOME/.dotnet/dotnet build -f net$DOTNET_VERSION-ios -c Release -p:RuntimeIdentifier=ios-arm64 -v n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
source $SCRIPT_DIR/prepare_env.sh | ||
|
||
banner "Executing build for .NET $DOTNET_VERSION Mac Catalyst" | ||
|
||
export DEVELOPER_DIR="/Applications/Xcode-16.0.0/" | ||
pushd $SCRIPT_DIR/../../../servers/dotnet/testserver | ||
$HOME/.dotnet/dotnet build -f net$DOTNET_VERSION-maccatalyst -c Release -v n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"$schema": "https://packages.couchbase.com/couchbase-lite/testserver.schema.json", | ||
"test-servers": ["http://localhost:8080"], | ||
"sync-gateways": [{"hostname": "localhost", "tls": true}], | ||
"couchbase-servers": [{"hostname": "localhost"}], | ||
"test-servers": ["http://{{test-server-ip}}:8080"], | ||
"sync-gateways": [{"hostname": "{{test-client-ip}}", "tls": true}], | ||
"couchbase-servers": [{"hostname": "{{test-client-ip}}"}], | ||
"api-version": 1, | ||
"logslurp": "localhost:8180", | ||
"logslurp": "{{test-client-ip}}:8180", | ||
"greenboard": {"hostname": "jenkins.mobiledev.couchbase.com", "username": "writer", "password": "couchbase2" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash -e | ||
|
||
export DOTNET_ROOT=$HOME/.dotnet | ||
export DOTNET_VERSION="8.0" | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
PREPARE_DOTNET_SCRIPT="$SCRIPT_DIR/prepare_dotnet.sh" | ||
|
||
if [ ! -f $PREPARE_DOTNET_SCRIPT ]; then | ||
echo "Downloading prepare_dotnet.sh..." | ||
curl -L https://raw.githubusercontent.com/couchbaselabs/couchbase-mobile-tools/refs/heads/master/dotnet_testing_env/prepare_dotnet_new.sh -o $PREPARE_DOTNET_SCRIPT | ||
fi | ||
|
||
source $PREPARE_DOTNET_SCRIPT | ||
|
||
function copy_datasets() { | ||
banner "Copying dataset resources" | ||
|
||
mkdir -p $SCRIPT_DIR/../../../servers/dotnet/testserver/Resources/Raw | ||
pushd $SCRIPT_DIR/../../../servers/dotnet/testserver/Resources/Raw | ||
cp -fv $SCRIPT_DIR/../../../dataset/server/dbs/*.zip . | ||
cp -Rfv $SCRIPT_DIR/../../../dataset/server/blobs . | ||
popd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
servers/dotnet/scripts/run_mac.sh → jenkins/pipelines/dotnet/run_mac.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
pushd $SCRIPT_DIR/../testserver | ||
pushd $SCRIPT_DIR/../../../servers/dotnet/testserver | ||
|
||
app_location=$(find bin/Release/net8.0-maccatalyst -name "*.app") | ||
app_location=$PWD/bin/Release/net8.0-maccatalyst/testserver.app | ||
if [ -z "$app_location" ]; then | ||
echo "Unable to find app to run, was it built?" | ||
exit 1 | ||
fi | ||
|
||
source $SCRIPT_DIR/prepare_env.sh | ||
banner "Running $app_location" | ||
open $app_location |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
function usage() { | ||
echo "Usage: stop_ios.sh device-id" | ||
echo " device-id The UUID of the device to stop the test server on" | ||
} | ||
|
||
if [ $# -lt 1 ]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
pushd $SCRIPT_DIR | ||
|
||
source $SCRIPT_DIR/prepare_env.sh | ||
if [ ! -f ios_pid.txt ]; then | ||
echo "Unable to find ios_pid.txt, was the app started using run_ios.sh?" | ||
exit 2 | ||
fi | ||
|
||
pid=$(cat ios_pid.txt) | ||
rm ios_pid.txt | ||
|
||
banner "Stopping com.couchbase.dotnet.testserver ($pid) on device $1" | ||
output=$($HOME/.dotnet/tools/xharness apple mlaunch -- --devname $1 --killdev $pid 2> /dev/null) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
source $SCRIPT_DIR/test_common.sh | ||
source $SCRIPT_DIR/prepare_env.sh | ||
|
||
banner "Looking up connected Android device" | ||
android_device=$($HOME/.dotnet/tools/xharness android device) | ||
if [ "$android_device" == "" ]; then | ||
echo "Failed to find Android device" | ||
exit 2 | ||
else | ||
echo "Found $android_device" | ||
fi | ||
|
||
banner "Shutdown Test Server for Android" | ||
$SCRIPT_DIR/stop_android.sh $android_device | ||
|
||
banner "Shutdown Environment" | ||
end_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
source $SCRIPT_DIR/test_common.sh | ||
source $SCRIPT_DIR/prepare_env.sh | ||
|
||
banner "Looking up connected iOS device" | ||
|
||
ios_devices=$($HOME/.dotnet/tools/xharness apple device ios-device) | ||
ios_device=$(echo $ios_devices | head -1) | ||
echo "Found device $ios_device..." | ||
|
||
banner "Shutdown Test Server for iOS" | ||
$SCRIPT_DIR/stop_ios.sh $ios_device | ||
|
||
banner "Shutdown Environment" | ||
end_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
source $SCRIPT_DIR/test_common.sh | ||
source $SCRIPT_DIR/prepare_env.sh | ||
|
||
banner "Shutdown Test Server for Mac Catalyst" | ||
$SCRIPT_DIR/stop_mac.sh | ||
|
||
banner "Shutdown Environment" | ||
end_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
source $SCRIPT_DIR/test_common.sh | ||
|
||
sgw_url="$4" | ||
if [ $# -lt 3 ]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
prepare_dotnet | ||
|
||
modify_package $2 $3 | ||
$SCRIPT_DIR/build_android.sh | ||
|
||
banner "Looking up connected Android device" | ||
android_device=$($HOME/.dotnet/tools/xharness android device) | ||
if [ "$android_device" == "" ]; then | ||
echo "Failed to find Android device" | ||
exit 2 | ||
else | ||
echo "Found $android_device" | ||
fi | ||
|
||
banner "Resolving Test Server IP" | ||
test_server_ip=$($HOME/.dotnet/tools/xharness android adb -- shell ifconfig wlan0 | grep "inet addr" | awk '{print substr($2, 6)}') | ||
if [ "$test_server_ip" == "" ]; then | ||
echo "Failed to find Android test server..." | ||
exit 2 | ||
else | ||
echo "Resolved to $test_server_ip!" | ||
fi | ||
|
||
my_ip=$(ifconfig en0 | grep "inet " | awk '{print $2}') | ||
echo "Detected TDK client IP as $my_ip" | ||
|
||
$SCRIPT_DIR/run_android.sh $android_device | ||
$SCRIPT_DIR/../shared/setup_backend.sh $sgw_url | ||
|
||
begin_tests $test_server_ip $my_ip |
Oops, something went wrong.