Skip to content

Commit 6e5c998

Browse files
weitzmanstasadev
andauthored
Preserve TESTDIR when using Github Actions (#79)
Co-authored-by: Stanislav Zhuk <[email protected]>
1 parent 5e8a91c commit 6e5c998

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test.bats

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ health_checks() {
5555
teardown() {
5656
set -eu -o pipefail
5757
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1
58-
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR}
58+
# Persist TESTDIR if running inside GitHub Actions. Useful for uploading test result artifacts
59+
# See example at https://github.com/ddev/github-action-add-on-test#preserving-artifacts
60+
if [ -n "${GITHUB_ENV:-}" ]; then
61+
echo "TESTDIR=${TESTDIR}" >> "${GITHUB_ENV}"
62+
else
63+
[ "${TESTDIR}" != "" ] && rm -rf "${TESTDIR}"
64+
fi
5965
}
6066

6167
@test "install from directory" {

0 commit comments

Comments
 (0)