diff --git a/.drone.jsonnet b/.drone.jsonnet index ff9d27809..a073e5757 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -108,22 +108,7 @@ local pre_boot_test_sim = { local clean_up_test_simulator = { name: 'Clean Up Test Simulator', commands: [ - ||| - function handle_exit() { - xcrun simctl delete unavailable - - if [ -e build/artifacts/sim_uuid ]; then - xcrun simctl delete $(<./build/artifacts/sim_uuid) - fi - exit 0 - } - - trap handle_exit EXIT - - while true; do - sleep 10 - done - ||| + './Scripts/clean-up-test-simulator.sh $(<./build/artifacts/sim_uuid)' ], depends_on: [ 'Pre-Boot Test Simulator', diff --git a/Scripts/clean-up-test-simulator.sh b/Scripts/clean-up-test-simulator.sh new file mode 100755 index 000000000..6c5a4f548 --- /dev/null +++ b/Scripts/clean-up-test-simulator.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# +# Script used with Drone CI to delete the simulator created for the unit tests when the pipline ends. + +if [[ -z "$1" ]]; then + echo -e "\n\n\n\n\e[31;1mSimulator UUID not provided.\e[0m\n\n\n" + exit 1 +fi + +SIM_UUID="$1" + +function handle_exit() { + xcrun simctl delete unavailable + xcrun simctl delete ${SIM_UUID} + exit 0 +} + +trap handle_exit EXIT + +while true; do + sleep 10 +done \ No newline at end of file