include:
  - template: Jobs/SAST.gitlab-ci.yml

cache:
  paths:
    - .m2/repository

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"

stages:
- build
- test
- package

build-battlearena:
  stage: build
  image: maven:3.9.4-eclipse-temurin-20
  script:
  - "echo 'Starting Build Stage'"
  - "mvn compile -X"
test-battlearena:
  stage: test
  image: maven:3.9.4-eclipse-temurin-20
  script:
  - "echo 'Starting Test Stage'"
  - "mvn test"
  artifacts:
    reports:
      junit:
      - target/surefire-reports/TEST-*.xml
      - target/failsafe-reports/TEST-*.xml
package-battlearena:
  stage: package
  image: maven:3.9.4-eclipse-temurin-20
  script:
  - "echo 'Starting Package Stage'"
  - "mvn package"
  only:
    refs:
    - main
  artifacts:
    paths:
    - target/*.jar
    expire_in: 2 days
