.gitlab-ci.yml 1.31 KB
Newer Older
1
image: node:6.12.2
2

3 4 5 6 7 8 9
services:
    - postgres:latest

variables:
    POSTGRES_DB: 'blendb_fixture'
    POSTGRES_USER: 'runner'
    POSTGRES_PASSWORD: ''
10
    PKG_VERSION: 'latest'
11
    DOCKER_URL: 'marula.c3sl.ufpr.br:5000/c3sl/blendb:'
12

13 14
cache:
    paths:
15
        - node_modules
16

17 18 19 20 21
stages:
    - test
    - build
    - deploy

22 23

run_tests:
24 25
    stage: test
    before_script:
26
        - yarn install --frozen-lockfile --silent --non-interactive
27
    script:
28
        - mv config/ci_test.yaml.example config/test.yaml
29
        - mv config/ci_test.env.example config/test.env
30 31
        - yarn test
        - yarn run lint
32 33
    tags:
        - node
34
        - postgres
35 36 37
build:
    stage: build
    variables:
38
        PKG_VERSION: ''
39 40 41
    script:
        - PKG_VERSION=$(cat package.json | grep \"version\" | cut -f2 -d':'| sed -e 's/"\|,//g' | tr -d ' ')
        - echo ${PKG_VERSION}
42
        - docker build -t ${DOCKER_URL}${PKG_VERSION} -t ${DOCKER_URL}latest .
43 44 45 46 47 48 49
    tags:
        - docker
        - build

deploy:
    stage: deploy
    variables:
50
        PKG_VERSION: ''
51 52
    script:
        - PKG_VERSION=$(cat package.json | grep \"version\" | cut -f2 -d':'| sed -e 's/"\|,//g' | tr -d ' ')
53 54
        - docker push ${DOCKER_URL}${PKG_VERSION}
        - docker push ${DOCKER_URL}latest
55 56 57 58 59 60
    tags:
        - docker
        - build
    only:
        - master