Skip to content

Commit

Permalink
Fix mistaken Jenkinsfile and add .NET Android
Browse files Browse the repository at this point in the history
pwsh should be shell outside of Windows
  • Loading branch information
borrrden committed Nov 1, 2024
1 parent d9ef0d9 commit 22aa810
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 21 deletions.
46 changes: 28 additions & 18 deletions jenkins/pipelines/dotnet/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pipeline {
string(name: 'SGW_URL', defaultValue: '', description: "The url of Sync Gateway to download")
}
options {
timeout(time: 30, unit: 'MINUTES')
timeout(time: 120, unit: 'MINUTES')
ansiColor('xterm')
timestamps()
}
Expand Down Expand Up @@ -38,31 +38,41 @@ pipeline {
stage("Mac Catalyst") {
agent { label 'mob-e2e-mac-01' }
steps {
pwsh "jenkins\\pipelines\\dotnet\\test_mac.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.SGW_URL}"
shell "jenkins\\pipelines\\dotnet\\test_mac.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.SGW_URL}"
}
post {
always {
pwsh 'jenkins\\pipelines\\dotnet\\teardown_mac.sh'
shell 'jenkins\\pipelines\\dotnet\\teardown_mac.sh'
}
}
}
}
}
stage('Mobile') {
parallel {
stage("iOS") {
options {
lock("mob-e2e-iphone-01")
}
agent { label 'mob-e2e-mac-01' }
steps {
pwsh "jenkins\\pipelines\\dotnet\\test_ios.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.SGW_URL}"
}
post {
always {
pwsh 'jenkins\\pipelines\\dotnet\\teardown_ios.sh'
}
}
stage('iOS') {
options {
lock("mob-e2e-iphone-01")
}
agent { label 'mob-e2e-mac-01' }
steps {
shell "jenkins\\pipelines\\dotnet\\test_ios.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.SGW_URL}"
}
post {
always {
shell 'jenkins\\pipelines\\dotnet\\teardown_ios.sh'
}
}
}
stage('Android') {
options {
lock("mob-e2e-android-01")
}
agent { label 'mob-e2e-mac-01' }
steps {
shell "jenkins\\pipelines\\dotnet\\test_android.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.SGW_URL}"
}
post {
always {
shell 'jenkins\\pipelines\\dotnet\\teardown_android.sh'
}
}
}
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions jenkins/pipelines/dotnet/teardown_android.sh
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
25 changes: 22 additions & 3 deletions jenkins/pipelines/dotnet/test_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,33 @@ if [ $# -lt 3 ]; then
exit 1
fi

#prepare_dotnet
prepare_dotnet

modify_package $2 $3
$SCRIPT_DIR/build_android.sh

android_device=$($HOME/.dotnet/tools/xharness android device) || echo "Failed to find Android device"; exit 2
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
begin_tests $test_server_ip $my_ip

0 comments on commit 22aa810

Please sign in to comment.