Skip to content

Commit

Permalink
Enable Shell-Check for circle CI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
spyridon97 committed Dec 4, 2023
1 parent fab66d4 commit 3518006
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .shellcheck_exclude_paths
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
scripts/ci/circle/postCDashStatus.sh
scripts/ci/circle/run.sh
scripts/ci/gh-actions/check-branch-name.sh
scripts/ci/gh-actions/get-changed-files.sh
scripts/ci/gh-actions/macos-setup.sh
Expand Down
7 changes: 4 additions & 3 deletions scripts/ci/circle/postCDashStatus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ USER=${STATUS_ROBOT_NAME}
TOKEN=${STATUS_ROBOT_KEY}
COMMIT=${CIRCLE_SHA1}
CDASH_STATUS_CONTEXT="cdash"
SOURCE_DIR="$(readlink -f ${CIRCLE_WORKING_DIRECTORY}/source)"
SOURCE_DIR="$(readlink -f "${CIRCLE_WORKING_DIRECTORY}"/source)"

build_status_body() {
cat <<EOF
Expand All @@ -18,8 +18,9 @@ EOF
}

PYTHON_SCRIPT="${SOURCE_DIR}/scripts/ci/findStatus.py"
curl -u "${USER}:${TOKEN}" "${API_BASE}/commits/${COMMIT}/statuses" | python3 ${PYTHON_SCRIPT} --context ${CDASH_STATUS_CONTEXT}
if [ $? -ne 0 ]
curl -u "${USER}:${TOKEN}" "${API_BASE}/commits/${COMMIT}/statuses" | python3 "${PYTHON_SCRIPT}" --context ${CDASH_STATUS_CONTEXT}
exit_status=$?
if [ "$exit_status" -ne 0 ]
then
echo "Need to post a status for context ${CDASH_STATUS_CONTEXT}"
postBody="$(build_status_body)"
Expand Down
11 changes: 7 additions & 4 deletions scripts/ci/circle/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash --login

# shellcheck source=/dev/null
. /etc/profile.d/modules.sh

# Parse the branch name used by the PR
Expand All @@ -8,8 +9,9 @@ REALBRANCH="${CIRCLE_BRANCH}"
if [ -n "${CIRCLE_PR_NUMBER}" ]
then
APIURL="${API_BASE}/pulls/${CIRCLE_PR_NUMBER}"
RESULT="$(curl -s ${APIURL} | python3 -c "import sys, json; print(json.load(sys.stdin)['head']['ref'])" 2> /dev/null)"
if [ $? -eq 0 ]
RESULT="$(curl -s "${APIURL}" | python3 -c "import sys, json; print(json.load(sys.stdin)['head']['ref'])" 2> /dev/null)"
exit_status=$?
if [ "$exit_status" -eq 0 ]
then
REALBRANCH="$(echo "${RESULT}" | tr '/' '-')"
fi
Expand Down Expand Up @@ -70,8 +72,9 @@ echo "**********Env End************"

echo "**********CTest Begin**********"
${CTEST} --version
echo ${CTEST} -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS}
${CTEST} -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS}
echo ${CTEST} -VV -S "${CTEST_SCRIPT}" -Ddashboard_full=OFF "${CTEST_STEP_ARGS}"
# shellcheck disable=SC2086
${CTEST} -VV -S "${CTEST_SCRIPT}" -Ddashboard_full=OFF ${CTEST_STEP_ARGS}
RET=$?
echo "**********CTest End************"

Expand Down

0 comments on commit 3518006

Please sign in to comment.