From 6670a634556bc21db366682340b74311b9dffaef Mon Sep 17 00:00:00 2001 From: Erwann Roussy Date: Fri, 3 Feb 2023 14:50:44 +0100 Subject: [PATCH 1/4] shellcheck Signed-off-by: Erwann Roussy --- .github/workflows/shellcheck.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000..4af5476f --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,17 @@ +name: "ShellCheck" + +on: + pull_request: + types: [opened, reopened, synchronize] + branches: [main] + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: ShellCheck + uses: ludeeus/action-shellcheck@2.0.0 + env: + SHELLCHECK_OPTS: -e SC2086 -e SC2154 From 6e4eea0457283fd29b14967656acac322914ce5e Mon Sep 17 00:00:00 2001 From: Erwann Roussy Date: Fri, 3 Feb 2023 15:32:10 +0100 Subject: [PATCH 2/4] launch.sh: correct shellcheck errors Correct all the warnings raised by shellcheck Signed-off-by: Erwann Roussy --- launch.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/launch.sh b/launch.sh index fb9f01bc..14781db1 100755 --- a/launch.sh +++ b/launch.sh @@ -8,7 +8,7 @@ set -e die() { - echo "CI internal failure : $@" 1>&2 + echo "CI internal failure : $*" 1>&2 exit 1 } @@ -41,6 +41,7 @@ initialization() { cqfd init cqfd -b prepare echo "Sources prepared succesfully" + exit 0 } # Launch Debian configuration and hardening @@ -55,6 +56,7 @@ configure_debian() { playbooks/cluster_setup_debian.yaml \ playbooks/cluster_setup_hardened_debian.yaml echo "Debian set up succesfully" + exit 0 } # Prepare, launch test and upload test report @@ -82,8 +84,8 @@ launch_test() { # Upload report - PR_N=`echo $GITHUB_REF | cut -d '/' -f 3` - TIME=`date +%F_%Hh%Mm%S` + PR_N=$(echo $GITHUB_REF | cut -d '/' -f 3) + TIME=$(date +%F_%Hh%Mm%S) REPORT_NAME=test-report_${GITHUB_RUN_ID}_${GITHUB_RUN_ATTEMPT}_${TIME}.pdf REPORT_DIR=${WORK_DIR}/reports/docs/reports/PR-${PR_N} @@ -116,15 +118,12 @@ launch_test() { case "$1" in init) initialization - exit 0 ;; conf) configure_debian - exit 0 ;; test) launch_test - exit 0 ;; *) usage From ecd04b483aa41eff86f01f7c223936f21357adcc Mon Sep 17 00:00:00 2001 From: Erwann Roussy Date: Fri, 3 Feb 2023 15:37:55 +0100 Subject: [PATCH 3/4] wip --- report-generator/compile.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/report-generator/compile.sh b/report-generator/compile.sh index 1ef45b04..f535c0b8 100755 --- a/report-generator/compile.sh +++ b/report-generator/compile.sh @@ -88,10 +88,11 @@ add_xml_to_adoc() local nb_suites="$(( $(xmlstarlet sel -t -v '//testsuite/@name' "$xml"\ |wc -l) +1 ))" for i in $(seq 1 ${nb_suites}) ; do - local testname=$(xmlstarlet sel -t -v "//testsuite[$i]/@name" "$xml") - local classname=$(xmlstarlet sel -t -v "//testsuite[$i]/testcase[1]/@classname" "$xml") - local nb_tests=$(xmlstarlet sel -t -v "//testsuite[$i]/@tests" "$xml") - local failures=$(xmlstarlet sel -t -v "//testsuite[$i]/@failures" "$xml") + local testname classname nb_tests failures + testname=$(xmlstarlet sel -t -v "//testsuite[$i]/@name" "$xml") + classname=$(xmlstarlet sel -t -v "//testsuite[$i]/testcase[1]/@classname" "$xml") + nb_tests=$(xmlstarlet sel -t -v "//testsuite[$i]/@tests" "$xml") + failures=$(xmlstarlet sel -t -v "//testsuite[$i]/@failures" "$xml") local cols='"7,1"' if [ -z "$testname" -o "$testname" == "default" ] ; then testname=$(basename $xml) From 79907c5d12aa3d1ffb6d84e6c5ad34cd6c443a21 Mon Sep 17 00:00:00 2001 From: Erwann Roussy Date: Fri, 3 Feb 2023 15:40:43 +0100 Subject: [PATCH 4/4] wip --- report-generator/compile.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/report-generator/compile.sh b/report-generator/compile.sh index f535c0b8..1c36ccce 100755 --- a/report-generator/compile.sh +++ b/report-generator/compile.sh @@ -94,11 +94,11 @@ add_xml_to_adoc() nb_tests=$(xmlstarlet sel -t -v "//testsuite[$i]/@tests" "$xml") failures=$(xmlstarlet sel -t -v "//testsuite[$i]/@failures" "$xml") local cols='"7,1"' - if [ -z "$testname" -o "$testname" == "default" ] ; then + if [ -z "$testname" ] || [ -o "$testname" == "default" ] ; then testname=$(basename $xml) fi echo -n "=== Tests $testname" >> "$TEST_ADOC_FILE" - if [ -n "$classname" -a "$classname" != "cukinia" ] ; then + if [ -n "$classname" ] && [ "$classname" != "cukinia" ] ; then echo -n " for $classname" >> "$TEST_ADOC_FILE" fi echo >> "$TEST_ADOC_FILE"