Skip to content
Snippets Groups Projects
Commit 895155db authored by Jon Azpiazu's avatar Jon Azpiazu
Browse files

Add script and job for asciidoctor

parent 05ec1274
No related branches found
No related tags found
1 merge request!39WIP: Resolve "Add asciidoctor syntax check to CI tests"
......@@ -131,3 +131,19 @@ 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: check
image: alpine
before_script:
- apk add --update asciidoctor bash
script:
- bash <(curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/asciidoctor_syntax_check.bash) $$TARGET_REPO_PATH
tags:
- docker
allow_failure: yes
......@@ -133,3 +133,19 @@ 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: check
image: alpine
before_script:
- apk add --update asciidoctor bash
script:
- bash <(curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/asciidoctor_syntax_check.bash) $$TARGET_REPO_PATH
tags:
- docker
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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment