stages:
    - build
    - test
    - qa

# Cache Maven output
cache:
    key: "$CI_BUILD_REF_NAME"
    untracked: true

# Compile the code, must succeed before we start testing.
build:
    stage: build
    script: "mvn clean compile -B"

# Run the quick test suite (Unit tests mostly)
quicktests:
    stage: test
    script: "mvn test -B --fail-at-end"

# Run the integration test suite (Unit tests which don't use mocks and commonly exclude mock usages)
integration-tests:
    stage: test
    script: "mvn verify -B --fail-at-end"

# Run a sonar analysis.
sonar:
    stage: qa
    script: "mvn compile test-compile sonar:sonar -B -Dsonar.host.url=https://sonarqube.johnnei.org -Dsonar.branch=$CI_BUILD_REF_NAME"

stages:
    - build
    - test
    - qa

# Compile the code, must succeed before we start testing.
build:
    stage: build
    script: "mvn -B clean compile"

# Run the quick test suite (Unit tests mostly)
quicktests:
    stage: test
    script: "mvn -B test --fail-at-end"
    artifacts:
      paths:
      - target/jacoco.exec

# Run the integration test suite (Unit tests which don't use mocks and commonly exclude mock usages)
integration-tests:
    stage: test
    script: "mvn -B verify --fail-at-end"
    artifacts:
      paths:
      - target/jacoco-it.exec

# Run a sonar analysis.
sonar:
    stage: qa
    script: "mvn -B compile test-compile sonar:sonar -Dsonar.host.url=https://sonarqube.johnnei.org -Dsonar.branch=$CI_BUILD_REF_NAME"
    dependencies:
      - quicktests
      - integration-tests

Use artifacts instead of unreliable for SonarQube build step.
JBT-52: Use artifacts instead of unreliable for SonarQube build step.
