image: openjdk:8

before_script:
  #- apt-get update
  #- apt-get -y install ant

stages:
  - build
  - test
  - deploy

ci_build:
  stage: build
  script:
    - cd 1.sources/MyHealth
    - ant clean
    - ant ear

ci_test:
  stage: test
  script:
    - cd 1.sources/MyHealth
    #- ant clean all TestUnitarios

deploy_pre:
  stage: deploy
  script:
    - echo "Eliminamos archivo ear anterior..."
    - rm -f $JBOSS_HOME/standalone/deployments/MyHealth.*
    - echo "Despliegue al servidor de PRE"
    - cd 1.sources/MyHealth
    - ant deployear
    

  environment:
    name: pre
    url: https://localhost:8080/MyHealth
  only:
  - master

deploy_pro:
  stage: deploy
  script:
    - echo "Eliminamos archivo ear anterior..."
    - rm -f $JBOSS_HOME/standalone/deployments/MyHealth.*
    - echo "Despliegue al servidor de PRO"
    - cd 1.sources/MyHealth
    - ant deployear
    
  environment:
    name: pro
    url: https://localhost:8080/MyHealth
  when: manual
  only:
  - master