@@ -38,10 +38,11 @@ ERROR="Error: Expected ports to be defined! Example script usage:"
3838EXAMPLE=" run_cmb_service.sh -e <echo-server-port> -s <cmb-service-port>"
3939
4040# get arguments passed to the script
41- while getopts ' e:s:' flag; do
41+ while getopts ' e:s:l: ' flag; do
4242case " ${flag} " in
4343 e) echo_port=" ${OPTARG} " ;;
4444 s) service_port=" ${OPTARG} " ;;
45+ l) build_logs=" ${OPTARG} " ;;
4546 * ) printf " %s\n" " $ERROR " " $EXAMPLE "
4647 exit 1 ;;
4748 esac
@@ -91,89 +92,82 @@ logError(){
9192
9293# Unity Version -----------------------------------------------------------------
9394
95+ # This is the path to the logs from the standalone build job
96+ FILE=" $build_logs /TestResults.js"
9497
95- FILE=" artifacts/TestResults.js"
96-
97- echo " $( < $FILE ) "
98-
99-
100- first_sed=$( sed -n ' s/.*"editorVersion": *"\([^" (]*\).*/\1/p' $FILE )
101-
102-
103- second_sed=" $( sed -nE ' s/.*"editorVersion":[[:space:]]*"([^[:space:]"]+).*/\1/p' $FILE ) "
104-
105- project_settings=" $( sed -nE ' s/^m_EditorVersion:[[:space:]]*([[:alnum:].]+).*/\1/p' testproject/ProjectSettings/ProjectVersion.txt) "
98+ unity_version=$( sed -n ' s/.*"editorVersion": *"\([^" (]*\).*/\1/p' $FILE )
10699
107100# ensure arguments were passed and the ports are defined
108- if [ -z " $first_sed " ]; then
109- logMessage " Failed to find unity version: first: $first_sed , second: $second_sed , project_settings: $project_settings ! Using default string" ;
101+ if [ -z " $unity_version " ]; then
102+ logMessage " Failed to find unity version! Exiting..." ;
103+ exit 1;
110104else
111- logMessage " Found Unity version: first: $first_sed , second: $second_sed , project_settings: $project_settings " ;
105+ logMessage " Found Unity version: $unity_version " ;
112106fi
113107
114- # # Protocol Buffer Compiler ------------------------------------------------------
108+ # Protocol Buffer Compiler ------------------------------------------------------
115109
116- # # Apply any updates
117- # logMessage "Updating modules..."
118- # sudo apt-get update
110+ # Apply any updates
111+ logMessage " Updating modules..."
112+ sudo apt-get update
119113
120- # # Install Protocol Buffer Compiler (using apt-get)
121- # logMessage "Installing protocol buffer compiler as SUDO..."
122- # try sudo apt-get install -y protobuf-compiler
114+ # Install Protocol Buffer Compiler (using apt-get)
115+ logMessage " Installing protocol buffer compiler as SUDO..."
116+ try sudo apt-get install -y protobuf-compiler
123117
124- # # If the previous command failed, try without sudo
125- # if $ThrewError; then
126- # logMessage "Installing protocol buffer compiler as shell assigned account..."
127- # apt-get install -y protobuf-compiler
128- # else
129- # logMessage "Protocol buffer compiler was installed as sudo!"
130- # fi
118+ # If the previous command failed, try without sudo
119+ if $ThrewError ; then
120+ logMessage " Installing protocol buffer compiler as shell assigned account..."
121+ apt-get install -y protobuf-compiler
122+ else
123+ logMessage " Protocol buffer compiler was installed as sudo!"
124+ fi
131125
132- # # Add the PROTOC environment variable that points to the Protocol Buffer Compiler binary
133- # export PROTOC="/usr/bin/protoc"
126+ # Add the PROTOC environment variable that points to the Protocol Buffer Compiler binary
127+ export PROTOC=" /usr/bin/protoc"
134128
135- # # Validate the PROTOC env var by getting the protoc version
136- # try $PROTOC --version
129+ # Validate the PROTOC env var by getting the protoc version
130+ try $PROTOC --version
137131
138- # if $ThrewError; then
139- # logError "Failed to properly run protoc!"
140- # exit -1
141- # else
142- # logMessage "Protocol Buffer Compiler Installed & ENV variables verified!\n PROTOC path is: $PROTOC"
143- # fi
132+ if $ThrewError ; then
133+ logError " Failed to properly run protoc!"
134+ exit -1
135+ else
136+ logMessage " Protocol Buffer Compiler Installed & ENV variables verified!\n PROTOC path is: $PROTOC "
137+ fi
144138
145- # # clone the cmb service repo
146- # git clone https://github.com/Unity-Technologies/mps-common-multiplayer-backend.git
139+ # clone the cmb service repo
140+ git clone https://github.com/Unity-Technologies/mps-common-multiplayer-backend.git
147141
148- # # navigate to the cmb service directory
149- # cd ./mps-common-multiplayer-backend/runtime
142+ # navigate to the cmb service directory
143+ cd ./mps-common-multiplayer-backend/runtime
150144
151- # # Install rust
152- # curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
145+ # Install rust
146+ curl --proto ' =https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
153147
154- # # Add the cargo bin directory to the PATH
155- # export PATH="$HOME/.cargo/bin:$PATH"
148+ # Add the cargo bin directory to the PATH
149+ export PATH=" $HOME /.cargo/bin:$PATH "
156150
157- # # Echo server -------------------------------------------------------------------
151+ # Echo server -------------------------------------------------------------------
158152
159- # # Build the echo server
160- # logMessage "Beginning echo server build..."
161- # cargo build --example ngo_echo_server
153+ # Build the echo server
154+ logMessage " Beginning echo server build..."
155+ cargo build --example ngo_echo_server
162156
163- # # Run the echo server in the background
164- # logMessage "Running echo server tests..."
165- # cargo run --example ngo_echo_server -- --port $echo_port &
157+ # Run the echo server in the background
158+ logMessage " Running echo server tests..."
159+ cargo run --example ngo_echo_server -- --port $echo_port &
166160
167- # # CMB Service -------------------------------------------------------------------
161+ # CMB Service -------------------------------------------------------------------
168162
169- # # Build a release version of the standalone cmb service
170- # logMessage "Beginning service release build..."
171- # cargo build --release --locked
163+ # Build a release version of the standalone cmb service
164+ logMessage " Beginning service release build..."
165+ cargo build --release --locked
172166
173- # # Run the standalone service on an infinite loop in the background.
174- # # The infinite loop is required as the service will exit each time all connected clients disconnect.
175- # # This means the service will exit after each test. The infinite loop will immediately restart the service each time it exits.
176- # logMessage "Running service integration tests..."
177- # while :; do
178- # ./target/release/comb-server -l error --metrics-port 5000 standalone --port $service_port -t 60m --unity-version $unity_version;
179- # done & # <- use & to run the entire loop in the background
167+ # Run the standalone service on an infinite loop in the background.
168+ # The infinite loop is required as the service will exit each time all connected clients disconnect.
169+ # This means the service will exit after each test. The infinite loop will immediately restart the service each time it exits.
170+ logMessage " Running service integration tests..."
171+ while : ; do
172+ ./target/release/comb-server -l error --metrics-port 5000 standalone --port $service_port -t 60m --unity-version $unity_version ;
173+ done & # <- use & to run the entire loop in the background
0 commit comments