image: 'maven:3.8.5-openjdk-17-slim'

cache:
  paths:
    - .m2/repository

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
  MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version"

stages:
  - build
  - test

build:
  tags:
    - shared-fi
  stage: build
  script:
    - echo "We are building your project, $GITLAB_USER_LOGIN"
    - ls
    - ./mvnw clean install -Dmaven.test.skip=true $MAVEN_CLI_OPTS

test:
  tags:
    - shared-fi
  stage: test
  script:
    - echo "We are testing your project build, $GITLAB_USER_LOGIN"
    - ./mvnw test $MAVEN_CLI_OPTS