diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index 6eb6a50..4f039f2 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -21,6 +21,7 @@ jobs: run: | npm install npx ncc build index.js + cp cleanup.sh dist/ if [[ -n $(git status --porcelain) ]]; then echo "Repo is dirty"; git status --porcelain; diff --git a/action.yml b/action.yml index f55fc65..1398252 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ --- -name: setup-xvfb +name: run-with-xvfb description: "Run your headless tests with XVFB" branding: icon: monitor diff --git a/dist/cleanup.sh b/dist/cleanup.sh new file mode 100644 index 0000000..8a70daf --- /dev/null +++ b/dist/cleanup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +kill_xvfb () { + local xvfb_pids=`ps aux | grep tmp/xvfb-run | grep -v grep | awk '{print $2}'` + if [ "$xvfb_pids" != "" ]; then + echo "Killing the following xvfb processes: $xvfb_pids" + sudo kill $xvfb_pids + else + echo "No xvfb processes to kill" + fi +} + +kill_xvfb diff --git a/package.json b/package.json index 4b072bc..1f215a2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "setup-xvfb", + "name": "run-with-xvfb", "version": "1.0.0", "description": "Run your tests headlessly", "main": "index.js",