Commit 37372516 authored by Prada Sarasola, Miguel's avatar Prada Sarasola, Miguel
Browse files

Merge branch '17-add-asciidoctor-syntax-check-to-ci-tests-2' into 'master'

Resolve "Add asciidoctor syntax check to CI tests"

Closes #17

See merge request !41
parents 35ddb617 68dc39c8
Pipeline #19193 passed with stage
in 27 seconds
......@@ -147,3 +147,20 @@ file_syntax:
when: always
tags:
- docker
##########################################################
## Check for errors in Asciidoctor files
## Could not find a proper linter for Asciidoctor format,
## so this is a custom-made "dirty" script
##########################################################
adoc_syntax:
stage: postcheck
image: alpine
before_script:
- apk add --update curl asciidoctor bash
script:
- curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/asciidoctor_syntax_check.bash | bash -s -- .
tags:
- docker
when: always
allow_failure: yes
......@@ -149,3 +149,20 @@ file_syntax:
when: always
tags:
- docker
##########################################################
## Check for errors in Asciidoctor files
## Could not find a proper linter for Asciidoctor format,
## so this is a custom-made "dirty" script
##########################################################
adoc_syntax:
stage: postcheck
image: alpine
before_script:
- apk add --update curl asciidoctor bash
script:
- curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/asciidoctor_syntax_check.bash | bash -s -- .
tags:
- docker
when: always
allow_failure: yes
#!/bin/bash
if ! [ -x "$(command -v asciidoctor)" ]; then
echo "Error: asciidoctor is not installed"
exit 1
fi
if [ -z "$1" ] ; then
echo "Error: No argument supplied - path needed"
exit 1
fi
touch output.log # avoid failing if no adoc files exist
while IFS= read -r -d '' filename; do
asciidoctor "$filename" 2>&1 | tee -a output.log
done < <(find "$1" -name '*.adoc' -type f -print0)
adoc_errors=0 ; adoc_warnings=0
adoc_errors=$(grep -c "ERROR" output.log)
adoc_warnings=$(grep -c "WARNING" output.log)
echo "AsciiDoc format Found ${adoc_errors} errors and ${adoc_warnings} warnings"
if [ "${adoc_errors}" -eq 0 ]; then exit 0; else exit 1; fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment