Commit 98d03d4d authored by Björn Bartels's avatar Björn Bartels 👩🏻
Browse files

[PATLAB-2] fix package-lock.json

parent 5f39f442
Loading
Loading
Loading
Loading
+136 −5
Original line number Diff line number Diff line
# This file is a template, and might need editing before it works on your project.
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:latest
#image: node:latest

# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
#services:

# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
@@ -14,7 +14,138 @@ cache:
  paths:
  - node_modules/

test_async:
#test_async:
#  script:
#   - npm install
#   - npm test

stages:
  - setup
  - build
  - test
  - deploy

variables:
  BUILD_TARGET: dist
  BUILD_LABEL_TMPFILE: build.txt

before_script:
  - if [ -f ${BUILD_LABEL_TMPFILE} ]; then export BUILD_LABEL=`cat ${BUILD_LABEL_TMPFILE}`; fi


init:
  stage: setup
  tags:
    #- kunden-web
    #- node
    - php
  before_script:
    - export BUILD_LABEL=$(TZ=Europe/Berlin date +%Y%m%d-%H%M)
  script:
    # save timestamp to file
    - echo $BUILD_LABEL > ${BUILD_LABEL_TMPFILE}
    - echo -e "\n\n\n\e[96mCreated new build label \e[107;30;1m $BUILD_LABEL \e[0m\n\n\n"
    # other init commands
    - whoami
    - pwd
  artifacts:
    paths:
      - ${BUILD_LABEL_TMPFILE}

app-build:
  stage: build
  tags:
    #- kunden-web
    #- node
    - php
  dependencies:
    - init
  variables:
    BUILD_INFO_FILE: dist/build.txt
  script:
    # check if a build environment exists and copy it or install a new one if it doesn't
    - if [ -d /build-env_DOES_NOT_EXIT_USE_INSTALL_FOR_NOW/node_modules ] &&  [ -f /build-env/package-lock.json ];
      then echo -e "\e[96mFOUND EXISTING BUILD ENVIRONMENT" && mv /build-env/* ./;
      else echo -e "\e[93mNO EXISTING BUILD ENVIRONMENT - RUNNING INSTALL" && npm install;
      fi
    # list used packages
    - npm ls || true
    # run node build
    - npm run build
    # create build info file
    - echo -e "LABEL=`cat ${BUILD_LABEL_TMPFILE}`" > ${BUILD_INFO_FILE}
    - echo -e "TAG=${CI_COMMIT_TAG}" >> ${BUILD_INFO_FILE}
    - echo -e "COMMIT=${CI_COMMIT_SHA}" >> ${BUILD_INFO_FILE}
    - echo -e "PIPELINE=${CI_PIPELINE_ID}" >> ${BUILD_INFO_FILE}
    # print debug-info
    - cat ${BUILD_INFO_FILE}
    - ls -la ${BUILD_TARGET}
  artifacts:
    paths:
      - ${BUILD_TARGET}
      - node_modules
      - bin
      - gui
      - lib
      - test
      - .coveralls.yml


app-tests:
  stage: test
  tags:
    #- kunden-web
    - node
    #- php
  dependencies:
    - app-build
  variables:
    BUILD_TEST_COVERAGE_FILE: dist/coverage.xml
  script:
   - npm install
    # check if a build environment exists and copy it or install a new one if it doesn't
    #- php -v
    - node -v
    - npm test
  artifacts:
    paths:
      - ${BUILD_TARGET}


rsync:
  stage: deploy
  tags:
    - web-rsync-runner
  dependencies:
    - app-build
    - app-tests
  before_script:
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - mkdir -p ~/.ssh
    - eval $(ssh-agent -s)
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    - ssh-add <(echo "$SSH_STAGING_PRIVATE_KEY")
    - apt-get install rsync
  script:
    - ssh -p22 user@staging.example.com "mkdir -p /_tmp"
    - rsync -rav -e ssh --exclude='.git/' --exclude='.gitlab-ci.yml' --delete-excluded /${BUILD_TARGET}/ user@staging.example.com:/_tmp
    - ssh -p22 user@staging.example.com "mv /${BUILD_TARGET} /${BUILD_TARGET}_save && mv /_tmp /${BUILD_TARGET}"
    - ssh -p22 user@staging.example.com "rm -rf /${BUILD_TARGET}_save"
  only:
    refs:
      - master
  when: manual

ftp-demo:
  stage: deploy
  tags:
    - kunden-web
  dependencies:
    - app-build
    - app-tests
  script:
    - 'which lftp || ( apt-get update -qq && apt-get install -y -qq lftp )'
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -Rev ${BUILD_TARGET}/ ./$FTP_PATH/${BUILD_TARGET}  --parallel=10 --exclude-glob .git* --exclude .git/"
  only:
    refs:
      - master
  when: manual
+784 −392

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
    "dev": "gulp",
    "build": "gulp build",
    "demo": "gulp --demo",
    "reinstall": "rm -rf node_modules bower_components package-lock.json ; npm install;"
    "reinstall": "rm -rf node_modules package-lock.json ; npm install;"
  },
  "author": "Björn Bartels <coding@bjoernbartels.earth>",
  "license": "Apache-2.0",