Skip to content

Commit d3efa63

Browse files
[DEBUG] added more debug code to tool (- WIP PR #82 -)
1 parent a600f38 commit d3efa63

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

tests/fetch_cc-test-reporter

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666

6767
# to check though:
68-
diff -q <(tail -n 191 "$0" | head -n 189 | shasum -a 384 -t -) <(tail -n 1 "$0") || exit 70 ;
68+
diff -q <(tail -n 228 "$0" | head -n 226 | shasum -a 384 -t -) <(tail -n 1 "$0") || exit 70 ;
6969

7070
ulimit -t 90
7171
PATH="/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:${PATH}"
@@ -214,6 +214,10 @@ elif [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
214214

215215
curl -fLso ./ds-cli.sh "https://deepsource.io/cli" || EXIT_CODE=125 ;
216216

217+
if [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
218+
printf "::debug::%s\n" "Downloaded ds-cli.sh for DeepSource" ;
219+
fi ;
220+
217221
for i in 1 256 512 ; do
218222
# test sha1/sha512 signatures if found and sha256 even if not found
219223
if [[ ( -r ds-cli.sh.sha${i} ) ]] || [[ ( ${i} -eq 256 ) ]] ; then
@@ -226,12 +230,44 @@ elif [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
226230
done
227231

228232
if [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
233+
printf "::debug::%s\n" "Validated ds-cli.sh for DeepSource" ;
229234
chmod -v 751 ./ds-cli.sh || EXIT_CODE=77
230235
fi ;
231236

232237
if [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
233238
# ref: https://docs.deepsource.com/docs/analyzers-test-coverage#setup-test-coverage
239+
printf "::group::%s\n" "Running ./ds-cli.sh" ;
234240
{ sh ./ds-cli.sh ;} || EXIT_CODE=$? ; wait ;
241+
printf "::endgroup::\n" ;
242+
if [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
243+
printf "::debug::%s\n" "Checking for DeepSource CLI" ;
244+
if [[ ( -d ./bin ) ]] ; then
245+
printf "::debug::==> %s\n" "Found ./bin directory." ;
246+
if [[ ( -x ./bin/deepsource ) ]] ; then
247+
printf "::debug:: ==> %s\n" "Found ./bin/deepsource CLI tool" ;
248+
elif [[ ( -r ./bin/deepsource ) || ( -e ./bin/deepsource ) ]] ; then
249+
printf "::debug:: ==> %s\n" "Found ./bin/deepsource file. Permission Error" ;
250+
printf "::debug:: ==> %s\n" "Trying to apply permission corrections" ;
251+
chmod -v 751 ./bin/deepsource || EXIT_CODE=77 ;
252+
if [[ ( ${EXIT_CODE} -eq 0 ) ]] && [[ ( -x ./bin/deepsource ) ]] ; then
253+
printf "::debug:: ==> %s\n" "Fixed ./bin/deepsource CLI tool" ;
254+
else
255+
printf "::debug:: ==> %s\n" "Applying corrections Unsuccessful" ;
256+
EXIT_CODE=77 ;
257+
if
258+
else
259+
printf "::debug:: ==> %s\n" "Missing ./bin/deepsource CLI tool" ;
260+
EXIT_CODE=125 ;
261+
printf "::debug:: ==> %s\n" "Checking if bin is empty:" ;
262+
readonly BIN_FILES=$( ls -1 ./bin 2>/dev/null ;)
263+
printf "::debug:: ==> %s\n" "${BIN_FILES}" ;
264+
unset $BIN_FILES 2>/dev/null || : ;
265+
fi ;
266+
else
267+
printf "::debug::==> %s\n" "Missing ./bin directory." ;
268+
EXIT_CODE=125 ;
269+
fi ;
270+
fi ;
235271
fi ;
236272

237273
if [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
@@ -254,4 +290,4 @@ cleanup 2>/dev/null || rm -f "${LOCK_FILE}" 2>/dev/null > /dev/null || : ; wait
254290
exit ${EXIT_CODE:-255} ;
255291

256292
# This file's code hash:
257-
b42710735f3bad7c4912f5053d77ad52809bb53ad80bf250bf0b1af4dce6df2d12744328159ce06e2ce00a4c21e6bee8 -
293+
a3ffe4db431f0e6b2d32e6f4969a848da9b14257ae3461e968352825ab50ae7db48fd20359378c49d7f7e3ec2f3402d3 -

0 commit comments

Comments
 (0)