#image: maven:latest

variables:
  LANG: C.UTF-8
  LC_ALL: C.UTF-8
  # FTP_* variables are defined in the CI condiguration of the gitlab.

stages:
    - build
    - tests
    - ftp_deploy

build:
  stage: build
  image: maven:latest
  script:
    - mvn clean install -B -DskipTests -Dcheckstyle.fail=false
  tags:
    - shared-fi

tests:
  stage: tests
  image: maven:latest
  script:
    - mvn test -B -Dcheckstyle.fail=false
  tags:
    - shared-fi

ftp_deploy:
  stage: ftp_deploy
  image: ubuntu:latest
  script:
    - apt-get update -qq && apt-get install -y -qq lftp
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rnev $CI_PROJECT_DIR ./$FTP_TARGET_DIR --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
    - echo $FTP_HOST $FTP_USERNAME $FTP_PASSWORD $FTP_TARGET_DIR $CI_PROJECT_DIR
  tags:
    - shared-fi
#  only:
#    - master