image: "node:8.12.0" services: - postgres:latest variables: POSTGRES_DB: datapier_test POSTGRES_USER: runner POSTGRES_PASSWORD: "" DB_NAME: datapier DB_HOST: postgres DB_PASSWORD: "" DB_PORT: "" DB_USER: runner stages: - test - build - build-frontend - build-backend cache: paths: - backend/node_modules/ - frontend/node_modules/ build-all: stage: build script: - cd /opt/data-pier - sudo git pull - sudo npm i --prefix ./backend --no-save - sudo npm i --prefix ./frontend --no-save - sudo npm run build - sudo systemctl restart data-pier.service tags: - datapier - production only: - master build-backend: stage: build-backend script: - cd /opt/data-pier - sudo git pull - sudo npm run install:backend - sudo npm run build:backend - sudo npm run move-builds - sudo systemctl restart data-pier.service tags: - datapier - staging only: refs: - development changes: - backend/**/* - .gitlab-ci.yml build-frontend: stage: build-frontend script: - cd /opt/data-pier - sudo git pull - sudo npm run install:frontend - sudo npm run build:frontend - sudo npm run move-builds tags: - datapier - staging only: refs: - development changes: - frontend/**/* - .gitlab-ci.yml test-backend: stage: test script: - npm run install:backend - npm run test:backend only: changes: - backend/**/* - .gitlab-ci.yml test-frontend: stage: test script: - npm run install:frontend - npm run test:frontend only: changes: - frontend/**/* - .gitlab-ci.yml