variables:
  GRADLE_OPTS: "-Dorg.gradle.daemon=false"

before_script:
  - source "/home/gitlab-runner/.sdkman/bin/sdkman-init.sh"
  - sdk u java 11.0.12-open

stages:
  - build
  - test
  - analysis
  - publish

Build Application:
  stage: build
  script: ./gradlew build

Create Documentation:
  stage: build
  script: ./gradlew asciidoctorPdf

Test Application:
  stage: test
  script: ./gradlew check

sonarqube-check:
  stage: analysis
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
  script: ./gradlew sonarqube
  allow_failure: true

Publish Artifacts:
  stage: publish
  script: ./gradlew publish
