From b70d97fbc42d43b60f3b7991af94230fcf1c4f1b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 28 Mar 2021 01:09:07 +0300 Subject: .ci: random local repository directory --- .ci/local/test.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to '.ci/local') diff --git a/.ci/local/test.sh b/.ci/local/test.sh index 43b9bbb..e7cd2c7 100755 --- a/.ci/local/test.sh +++ b/.ci/local/test.sh @@ -2,18 +2,27 @@ set -o errexit -o nounset -o pipefail -readonly local_repo_path="$HOME/test_repo" +local_repo_path= readonly cgitize_conf_path="$HOME/etc/cgitize/cgitize.conf" readonly my_repos_path="$HOME/etc/cgitize/my_repos.py" readonly output_path="$HOME/var/cgitize/output" +cleanup() { + echo + echo ---------------------------------------------------------------------- + echo Cleaning up + echo ---------------------------------------------------------------------- + + rm -rf -- "$local_repo_path" +} + setup_local_repo() { echo echo ---------------------------------------------------------------------- echo Setting up upstream repository echo ---------------------------------------------------------------------- - mkdir -p -- "$local_repo_path" + local_repo_path="$( mktemp -d )" pushd -- "$local_repo_path" > /dev/null git init @@ -60,7 +69,7 @@ from cgitize.repo import Repo MY_REPOS = ( - Repo('test_repo', clone_url='$HOME/test_repo'), + Repo('test_repo', clone_url='$local_repo_path'), ) EOF } @@ -97,6 +106,7 @@ verify() { } main() { + trap cleanup EXIT setup run verify -- cgit v1.2.3