image: node

before_script:
  - apt-get update


stages:
  - build
  - test

test_frontend:
  stage: test
  script:
    - cd frontend-js
    - npm install  
    - npm test

build_war:
  image: debian
  stage: build
  only:
    - tags
  artifacts:
    paths:
      - minerva.war
  script:
    - apt-get install -y curl sudo gnupg git openjdk-8-jdk ant maven
    - curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
    - sudo apt-get install -y nodejs
    - ant maven-build
    - cp web/target/web-1.0.war minerva.war

build_debian_package:
  image: debian
  stage: build
  only:
    - tags
  artifacts:
    paths:
      - "debian/*.deb"
  script:
    - apt-get install -y curl sudo gnupg git openjdk-8-jdk ant maven dh-make build-essential lintian devscripts xsltproc fakeroot xsltproc docbook-xsl
    - curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
    - sudo apt-get install -y nodejs
    - export DEBFULLNAME="Piotr Gawron"
    - export DEBEMAIL="piotr.gawron@uni.lu"
    - ant debian-pkg

