---
# xos-gui unit test

- job-template:
    id: 'gui-unit-test'
    name: 'verify_{project}_unit-test'

    description: |
      Created by {id} job-template from ci-management/jjb/gui-unit.yaml  <br />
      Test for the new XOS GUI Single Page Application based on Angular

    triggers:
      - cord-infra-gerrit-trigger-patchset:
          gerrit-server-name: '{gerrit-server-name}'
          project-regexp: '^{project}$'
          branch-regexp: '{branch-regexp}'
          dependency-jobs: '{dependency-jobs}'
          file-include-regexp: '{all-files-regexp}'

    properties:
      - cord-infra-properties:
          build-days-to-keep: '{build-days-to-keep}'
          artifact-num-to-keep: '{artifact-num-to-keep}'

    # `npm install` can take >10m depending on connectivity
    wrappers:
      - lf-infra-wrappers:
          build-timeout: 20
          jenkins-ssh-credential: '{jenkins-ssh-credential}'

    scm:
      - lf-infra-gerrit-scm:
          git-url: '$GIT_URL/$GERRIT_PROJECT'
          refspec: '$GERRIT_REFSPEC'
          branch: '$GERRIT_BRANCH'
          submodule-recursive: 'false'
          choosing-strategy: gerrit
          jenkins-ssh-credential: '{jenkins-ssh-credential}'

    # `npm install` fails on 1Gb RAM
    node: 'ubuntu16.04-basebuild-1c-2g'
    project-type: freestyle
    concurrent: true

    builders:
      - shell: |
          #/usr/bin/env bash
          set -eu -o pipefail
          time npm install
          npm run lint
          npm test

