Commit 06991b08 authored by ymir's avatar ymir

script CI test&build

parent 19792731
Pipeline #62068 passed with stages
in 2 minutes and 39 seconds
stages:
- test
- build
# - deploy
before_script:
- apt-get update -y
- apt-get install -y openssh-client sshpass
- export SSHPASS=${SSH_USER_PASS}
test: # this block can be copied/past/renamed if you split tests on different blocks
stage: test
script:
# install requirements
- apt-get install -y python3 python3-pip pylint python3-numpy python3-psutil
# - pip3 install --upgrade pip
- pip3 install --extra-index-url http://91.121.9.53:81/archive --trusted-host 91.121.9.53 pythoncommontools neuralnetworkcommon
# setup, minimal UT
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/UT.neuralnetworktrainercli.conf neuralnetworktrainercli/conf/neuralnetworktrainercli.conf
- python3 setup.py build
- python3 setup.py install
- cd neuralnetworktrainercli
- bash help/neuralnetworktrainercli.sh
- cd ..
# code quality
- pylint --output-format=parseable neuralnetworktrainercli test > code_quality_report.txt || echo 0
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/pylint/neuralnetworktrainercli/${CI_BUILD_REF_NAME}
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} code_quality_report.txt ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/pylint/neuralnetworktrainercli/${CI_BUILD_REF_NAME}
# TODO : documentation
build: # this block can be copied/past/renamed if you split builds on different blocks
stage: build
script:
# tarball
- tar -czf neuralnetworktrainercli-${CI_BUILD_REF_NAME}.tar.gz neuralnetworktrainercli setup.py
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/archive/neuralnetworktrainercli
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} neuralnetworktrainercli-*.tar.gz ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/archive/neuralnetworktrainercli
#deploy_development:
# stage: deploy
# script:
## remove existing container
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker stop gitlabcicd_dev_neuralnetworktrainercli || echo 0
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker rm gitlabcicd_dev_neuralnetworktrainercli || echo 0
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker rmi gitlabcicd/dev_neuralnetworktrainercli || echo 0
## create log file/folder
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /home/${SSH_USER_NAME}/shared/log/neuralnetworktrainercli
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 touch /home/${SSH_USER_NAME}/shared/log/neuralnetworktrainercli/DEV.neuralnetworktrainercli.log
## edit & send docker file
# - sed -i s/"{SSH_USER_PASS}"/${SSH_USER_PASS}/g Dockerfile
# - sed -i s/"{SSH_PORT}"/${SSH_PORT}/g Dockerfile
# - sed -i s/"{SSH_USER_NAME}"/${SSH_USER_NAME}/g Dockerfile
# - sed -i s/"{ENVIRONMENT}"/DEV/g Dockerfile
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /tmp/neuralnetworktrainercli
# - sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} Dockerfile ${SSH_USER_NAME}@91.121.9.53:/tmp/neuralnetworktrainercli
## create container
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 "cd /tmp/neuralnetworktrainercli;docker build -t "gitlabcicd/dev_neuralnetworktrainercli" ."
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker create --name gitlabcicd_dev_neuralnetworktrainercli -v /home/${SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/DEV.neuralnetworktrainercli.conf:/usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf/neuralnetworktrainercli.conf -v /home/${SSH_USER_NAME}/shared/log/neuralnetworktrainercli/DEV.neuralnetworktrainercli.log:/usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/log/neuralnetworktrainercli.log -p 5001:5000 gitlabcicd/dev_neuralnetworktrainercli
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker start gitlabcicd_dev_neuralnetworktrainercli
## remove docker file
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 rm -R /tmp/neuralnetworktrainercli
# environment:
# name: development
# only:
# - development
#deploy_staging:
# stage: deploy
# script:
# environment:
# name: staging
# only:
# - staging
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment