pool:
    vmImage: 'ubuntu-latest'
  
stages:
  - stage: spellcheck
    jobs:
    - job: spellcheck_chapters
      container: fastexitlane/hunspell:latest
      continueOnError: true
      steps:
        - script: export HUNSPELL_FINDINGS=`for filename in chapter/*.md; do hunspell -l -d de_DE_frami,en_US -p ./.hunspellignore $filename; done | sort | uniq`
        - script: echo $HUNSPELL_FINDINGS
        - script: test "$HUNSPELL_FINDINGS" == ""
    - job: spellcheck_appendix
      container: fastexitlane/hunspell:latest
      continueOnError: true
      steps:
        - script: export HUNSPELL_FINDINGS=`for filename in appendix/*.tex; do hunspell -l -d de_DE_frami,en_US -p ./.hunspellignore -t $filename; done | sort | uniq`
        - script: echo $HUNSPELL_FINDINGS
        - script: test "$HUNSPELL_FINDINGS" == ""
  - stage: build
    jobs:
    - job: pandoc_latexmk
      steps:
        - script: ./build.sh pandoc
          displayName: Run Build Script with Pandoc Option
        - task: PublishBuildArtifacts@1
          inputs:
            ArtifactName: main.pdf
            PathtoPublish: ./main.pdf