#image: maven:latest

variables:
  LANG: C.UTF-8
  LC_ALL: C.UTF-8
  FTP_HORST: "ftpx.forpsi.com"
  FTP_USERNAME: "radek_oslejsekcz"
  FTP_PASSWORD: "yourPasswordHere"
  FTP_TARGET_DIR: "www/download"

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: maven: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 ./application/target/fidentisanalyst/ ./$FTP_TARGET_DIR --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
  tags:
    - shared-fi
#  only:
#    - master
