Add ubuntu-node

This commit is contained in:
NaiJi ✨ 2022-04-13 15:37:27 +03:00
parent 6e797467a5
commit c1d6c23151
2 changed files with 123 additions and 0 deletions

View File

@ -0,0 +1,94 @@
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

29
ubuntu-node/Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM ubuntu:18.04
ENV DOCKER_VERSION=19.03.13
ENV NODE_VERSION=17
RUN apt-get update && \
apt-get -y install git wget bash curl sshpass jq zip unzip build-essential rpm cmake && \
git --version && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/cache/apt/archives/*.deb && \
rm -f var/cache/apt/archives/partial/*.deb && \
rm -f /var/cache/apt/*.bin
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash && \
apt-get install -y nodejs && \
node -v && \
npm i yarn -g && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/cache/apt/archives/*.deb && \
rm -f var/cache/apt/archives/partial/*.deb && \
rm -f /var/cache/apt/*.bin
RUN wget https://download.docker.com/linux/static/edge/x86_64/docker-${DOCKER_VERSION}.tgz && \
tar xvfz docker-${DOCKER_VERSION}.tgz && \
rm docker-${DOCKER_VERSION}.tgz && \
cp ./docker/docker /usr/bin/ && \
docker -v