From d859a0a60a6c9bcd4bb3da5666b69cdfe4ecd8cf Mon Sep 17 00:00:00 2001 From: ShockedPlot7560 Date: Sun, 17 Dec 2023 00:47:21 +0100 Subject: [PATCH] fix action template --- action.yml | 7 +++---- run.sh | 3 +++ timeout.sh | 9 +++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 timeout.sh diff --git a/action.yml b/action.yml index 73e147f..72a5542 100644 --- a/action.yml +++ b/action.yml @@ -18,9 +18,9 @@ inputs: required: false default: '.env' timeout: - description: 'Timeout for tests' + description: 'Timeout for tests (in seconds)' required: false - default: '10' + default: '60' outputs: failed-tests: @@ -36,9 +36,8 @@ runs: - name: 'Run tests' shell: bash - timeout-minutes: ${{ inputs.timeout }} id: "run" - run: "${{github.action_path}}/run.sh ${{ steps.prepare.outputs.pocketmine_name }}" + run: "${{github.action_path}}/run.sh ${{ steps.prepare.outputs.pocketmine_name }} ${{ inputs.timeout }}" - name: 'Collect results' shell: bash diff --git a/run.sh b/run.sh index d8eff76..f871da1 100644 --- a/run.sh +++ b/run.sh @@ -1,5 +1,8 @@ #!/bin/bash POCKETMINE_NAME=$1 +TIMEOUT=$2 + +./timeout.sh $POCKETMINE_NAME $TIMEOUT & docker start -ia $POCKETMINE_NAME \ No newline at end of file diff --git a/timeout.sh b/timeout.sh new file mode 100644 index 0000000..a565229 --- /dev/null +++ b/timeout.sh @@ -0,0 +1,9 @@ +POCKETMINE_NAME=$1 +TIMEOUT_TIME=$2 + +while true +do + sleep $TIMEOUT_TIME + echo "Timeout reached, killing server" + docker kill $POCKETMINE_NAME +done \ No newline at end of file