-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-in-docker-from-git.sh
More file actions
executable file
路32 lines (22 loc) 路 1.2 KB
/
Copy pathtest-in-docker-from-git.sh
File metadata and controls
executable file
路32 lines (22 loc) 路 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# USAGE: TESTER=test-ex-1-5.js ./test-in-docker-from-git.sh https://github.com/adrienjoly/cours-nodejs-exercise-solutions.git
SECRET_REPO_URL="${1}" # e.g. "https://github.com/adrienjoly/cours-nodejs-exercise-solutions.git"
PUBLIC_REPO_URL=$(cut -d "@" -f2 <<< ${SECRET_REPO_URL}) # to hide credentials (secret) from repo URL, in CI logs
echo "Going to test server from ${PUBLIC_REPO_URL}..."
>&2 echo "Going to test server from ${PUBLIC_REPO_URL}..."
echo ""
echo "Remove previous student-code directory..."
rm -rf ./student-code 2>/dev/null >/dev/null
set -e # from now on, stop the script if any command returns a non-zero exit code
echo ""
echo "Clone student's repository (${PUBLIC_REPO_URL}, branch: ${GIT_BRANCH:=master})..."
git clone ${SECRET_REPO_URL} ./student-code --depth 10 --no-single-branch 2>&1 \
&& cd ./student-code \
&& git checkout ${GIT_BRANCH:=master} 2>&1 \
&& cd ..
# If you want to make some changes in the student's code, uncomment the following line
# read -p "Press ENTER when you're ready to run the tests" -n 1 -r
./test-in-docker-from-dir.sh ./student-code/
echo ""
echo "Remove previous student-code directory..."
rm -rf ./student-code 2>/dev/null >/dev/null