Merge branch 'bug/unity-pid' into 'main'
detect failed unity launch and retry Closes #60 See merge request kernel-panic/revival!38
This commit is contained in:
commit
d5a0430252
|
@ -22,6 +22,7 @@ build:
|
||||||
- echo "cloned to $GIT_CLONE_PATH"
|
- echo "cloned to $GIT_CLONE_PATH"
|
||||||
- chmod +x ./ci/build.sh
|
- chmod +x ./ci/build.sh
|
||||||
- ./ci/build.sh $UNITY_VERSION
|
- ./ci/build.sh $UNITY_VERSION
|
||||||
|
- cp ./readme.txt $BUILD_DIR
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
name: $CI_PROJECT_NAME-$CI_PIPELINE_ID
|
name: $CI_PROJECT_NAME-$CI_PIPELINE_ID
|
||||||
|
|
28
ci/build.sh
28
ci/build.sh
|
@ -12,6 +12,9 @@ echo "removing previous editor log..."
|
||||||
|
|
||||||
echo "starting build using unity v$unityversion..."
|
echo "starting build using unity v$unityversion..."
|
||||||
|
|
||||||
|
unitypid=-1
|
||||||
|
|
||||||
|
launch_unity () {
|
||||||
# launch unity in batch mode
|
# launch unity in batch mode
|
||||||
open -g $editorpath --args \
|
open -g $editorpath --args \
|
||||||
-batchmode \
|
-batchmode \
|
||||||
|
@ -22,18 +25,37 @@ open -g $editorpath --args \
|
||||||
-logFile $editorlogpath \
|
-logFile $editorlogpath \
|
||||||
-projectPath "$(pwd)/game"
|
-projectPath "$(pwd)/game"
|
||||||
|
|
||||||
# wait for editor log to exist
|
unitypid=`pgrep -n Unity`
|
||||||
tries=60
|
echo "launched unity ($unitypid)"
|
||||||
|
}
|
||||||
|
|
||||||
|
launch_unity
|
||||||
|
|
||||||
|
tries=120
|
||||||
count=0
|
count=0
|
||||||
while [ ! -f $editorlogpath ]
|
while [ ! -f $editorlogpath ]
|
||||||
do
|
do
|
||||||
|
if ps -p $unitypid > /dev/null
|
||||||
|
then
|
||||||
|
echo "waiting for unity ($unitypid)"
|
||||||
|
else
|
||||||
|
echo "unity is no longer running - trying again"
|
||||||
|
|
||||||
|
# reset launch attempts
|
||||||
|
count=0
|
||||||
|
launch_unity
|
||||||
|
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# wait a second
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# decrement
|
# decrement
|
||||||
count=`expr $count + 1`
|
count=`expr $count + 1`
|
||||||
|
|
||||||
if [ $count -eq $tries ] ; then
|
if [ $count -eq $tries ] ; then
|
||||||
echo "early timeout - $tries seconds elapsed since launch attempt"
|
echo "early timeout - $tries seconds elapsed since last launch attempt"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue