Skip to content

Commit

Permalink
add cleanup step
Browse files Browse the repository at this point in the history
  • Loading branch information
ShockedPlot7560 committed Jan 5, 2024
1 parent a8b270c commit 97018f0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,9 @@ runs:
- name: 'Collect results'
shell: bash
id: "finish"
run: "${{github.action_path}}exitpoint.sh ${{ steps.prepare.outputs.pocketmine_name }}"
run: "${{github.action_path}}exitpoint.sh ${{ steps.prepare.outputs.pocketmine_name }}"

post:
- name: "Cleanup"
shell: bash
run: "${{github.action_path}}cleanup.sh ${{ steps.prepare.outputs.container_prefix }}
5 changes: 5 additions & 0 deletions cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONTAINER_PREFIX=$1

docker rm -fv $CONTAINER_PREFIX-pocketmine || true
docker rm -fv $CONTAINER_PREFIX-mysql || true
docker network rm $CONTAINER_PREFIX-network || true
2 changes: 0 additions & 2 deletions exitpoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
POCKETMINE_NAME=$1

docker cp $POCKETMINE_NAME:/data/plugin_data/PmmpUnit/results.txt /tmp/failed.txt
docker rm $POCKETMINE_NAME > /dev/null
docker volume prune -f > /dev/null

echo "failed-tests=$(cat /tmp/failed.txt)" >> $GITHUB_OUTPUT

Expand Down
3 changes: 2 additions & 1 deletion prepare.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

CONTAINER_PREFIX="pmmpunit-tests"
CONTAINER_PREFIX=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
echo "container_prefix=$CONTAINER_PREFIX" >> $GITHUB_OUTPUT
PHP_VERSION=$1
TESTS_PATH=$2
SUITE_TEST=$3
Expand Down

0 comments on commit 97018f0

Please sign in to comment.