code-snippets/docker/ubuntu-node/.gitlab-ci.yml

95 lines
2.3 KiB
YAML

stages:
- build
- test
- integration
- public
variables:
VERSION: 1.1.0
VERSION_NUMBER: "${VERSION}.${CI_PIPELINE_IID}"
STORAGE_FOLDER: "frontend"
before_script:
- |
if [ -f "package.json" ]; then
export VERSION=$(jq -r ".version // \"${VERSION}\"" package.json)
export STORAGE_FOLDER=$(jq -r ".storage // \"${STORAGE_FOLDER}\"" package.json)
fi
- export VERSION=$VERSION.$CI_PIPELINE_IID
- export VERSION_NUMBER=$VERSION
- yarn install
build:
stage: build
image: url-to-ubuntu-image:latest
tags:
- docker
- dind
script:
- CI=false yarn run build
- pwd
- mkdir package
- mkdir -p cmake-build
- cd cmake-build
- cmake ../pkg
- make package
- mv $STORAGE_FOLDER-$VERSION_NUMBER-Linux.deb ../package/
artifacts:
paths:
- package
expire_in: 1 day
test:
stage: test
image: url-to-ubuntu-image:latest
tags:
- docker
- dind
script:
- CI=false yarn test
integration:
stage: integration
allow_failure: true
needs:
- job: build
artifacts: true
image: url-to-ubuntu-image:latest
tags:
- docker
- dind
script:
- echo " Whoa! Master merge!!! Testing App integration! Wrooom wroom C:"
- wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
- tar -xf geckodriver-v0.30.0-linux64.tar.gz
- mv geckodriver /usr/local/bin/
- cd ./integration
- npm install
- npm install --save-dev jest
- npm install selenium-webdriver
- npm test tests.test.js
- cd ~
public_deb:
stage: public
needs:
- job: build
artifacts: true
image: url-to-ubuntu-image:latest
dependencies:
- build
tags:
- docker
- dind
script:
- echo $VERSION_NUMBER
- echo $CI_PIPELINE_IID
- ls -la package
- sshpass -p $EXP_STORE2_ROOT_PASSWORD ssh -o StrictHostKeyChecking=no $EXP_STORE2_ROOT_USER@storage.url "mkdir -p /home/storage/$STORAGE_FOLDER/$CI_COMMIT_REF_NAME/ASTRA/$VERSION_NUMBER"
- sshpass -p $EXP_STORE2_ROOT_PASSWORD scp package/$STORAGE_FOLDER-$VERSION_NUMBER-Linux.deb $EXP_STORE2_ROOT_USER@storage-url:/home/storage/$STORAGE_FOLDER/$CI_COMMIT_REF_NAME/ASTRA/$VERSION_NUMBER/$STORAGE_FOLDER-$VERSION_NUMBER-Linux.deb
only:
- master
- develop