ci: enable release stage
Signed-off-by: Thomas Klaehn <thomas.klaehn@u-blox.com>
This commit is contained in:
parent
4646c7d7a6
commit
f4ad11e92b
@ -4,7 +4,7 @@ before_script:
|
|||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
# - release
|
- release
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
stage: test
|
stage: test
|
||||||
@ -14,16 +14,14 @@ tests:
|
|||||||
- "nosetests --with-xunit tests/unittests/"
|
- "nosetests --with-xunit tests/unittests/"
|
||||||
- "sonar-runner"
|
- "sonar-runner"
|
||||||
|
|
||||||
#releases:
|
releases:
|
||||||
# stage: release
|
stage: release
|
||||||
# script:
|
script:
|
||||||
# - "python scripts/create_release_script.py"
|
- "python scripts/create_release_script.py"
|
||||||
# - "cd source"
|
- "python setup.py sdist"
|
||||||
# - "python release.py sdist"
|
- "scripts/deploy_release.sh"
|
||||||
# - "cd .."
|
only:
|
||||||
# - "scripts/deploy_release.sh"
|
- /^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$/
|
||||||
# only:
|
except:
|
||||||
# - /^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$/
|
- branches
|
||||||
# except:
|
|
||||||
# - branches
|
|
||||||
|
|
||||||
|
10
gate_guard.service
Normal file
10
gate_guard.service
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Chickenhouse gate guard service
|
||||||
|
After=multi-user.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=idle
|
||||||
|
ExecStart=/usr/bin/python /usr/local/lib/python2.7/dist-packages/gate_guard/__init__.py
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -9,7 +9,6 @@ import data_buffer
|
|||||||
import light_sensor
|
import light_sensor
|
||||||
import engine
|
import engine
|
||||||
import power_sensor
|
import power_sensor
|
||||||
from numpy.core.umath import power
|
|
||||||
|
|
||||||
STATE_INIT = "init"
|
STATE_INIT = "init"
|
||||||
STATE_OPENED = "open"
|
STATE_OPENED = "open"
|
||||||
|
65
scripts/create_release_script.py
Executable file
65
scripts/create_release_script.py
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
'''
|
||||||
|
Created on Mar 13, 2017
|
||||||
|
|
||||||
|
@author: tkl
|
||||||
|
'''
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
DAEMON_START_SCRIPT_SRC = 'gate_guard.service'
|
||||||
|
DAEMON_START_SCRIPT_DST = '/lib/systemd/system/' + DAEMON_START_SCRIPT_SRC
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
project_version = ''
|
||||||
|
project_name = ''
|
||||||
|
project_namespace = ''
|
||||||
|
if os.environ.has_key('CI_BUILD_TAG'):
|
||||||
|
project_version = str(os.environ.get('CI_BUILD_TAG')).strip()
|
||||||
|
# else:
|
||||||
|
# return -1
|
||||||
|
|
||||||
|
if os.environ.has_key('CI_PROJECT_NAME'):
|
||||||
|
project_name = str(os.environ.get('CI_PROJECT_NAME')).strip()
|
||||||
|
# else:
|
||||||
|
# return -1
|
||||||
|
|
||||||
|
if os.environ.has_key('CI_PROJECT_NAMESPACE'):
|
||||||
|
project_namespace = str(os.environ.get('CI_PROJECT_NAMESPACE')).strip()
|
||||||
|
# else:
|
||||||
|
# return -1
|
||||||
|
|
||||||
|
setup_str = ' setup(name=\'' + project_name + '\', '
|
||||||
|
setup_str += 'version=\'' + project_version + '\', '
|
||||||
|
setup_str += 'author=\'tkl\', '
|
||||||
|
setup_str += 'author_email=\'tkl@blackfinn.de\', '
|
||||||
|
setup_str += 'url=\'https://files.blackfinn.de/' + project_namespace + \
|
||||||
|
'/' + project_name + '\', '
|
||||||
|
setup_str += 'packages=[\'gate_guard\']'
|
||||||
|
setup_str_sdist = setup_str + ', scripts=[\'' + DAEMON_START_SCRIPT_SRC + '\'])\n'
|
||||||
|
setup_str += ')\n'
|
||||||
|
|
||||||
|
handle = open('setup.py', 'w')
|
||||||
|
handle.write('#!/usr/bin/env python\n')
|
||||||
|
handle.write('from distutils.core import setup\n')
|
||||||
|
handle.write('import shutil\n')
|
||||||
|
handle.write('import os\n')
|
||||||
|
handle.write('import stat\n')
|
||||||
|
handle.write('import sys\n\n')
|
||||||
|
handle.write('if sys.argv[1] == \'install\':\n')
|
||||||
|
handle.write(' shutil.copyfile(\'' + DAEMON_START_SCRIPT_SRC + \
|
||||||
|
'\', \'' + DAEMON_START_SCRIPT_DST + '\')\n')
|
||||||
|
handle.write(' os.chmod(\'' + DAEMON_START_SCRIPT_DST + \
|
||||||
|
'\', stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)\n')
|
||||||
|
handle.write(setup_str)
|
||||||
|
handle.write('elif sys.argv[1] == \'sdist\':\n')
|
||||||
|
handle.write(setup_str_sdist)
|
||||||
|
handle.write('\n')
|
||||||
|
|
||||||
|
handle.close()
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main(sys.argv[1:]))
|
||||||
|
|
20
scripts/deploy_release.sh
Executable file
20
scripts/deploy_release.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [ -z ${CI_BUILD_TAG+x} ]; then
|
||||||
|
echo "Tag name not found"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
if [ -z ${CI_PROJECT_NAME+x} ]; then
|
||||||
|
echo "Project name not found"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
delim="-"
|
||||||
|
file_ext=".tar.gz"
|
||||||
|
file=$CI_PROJECT_NAME$delim$CI_BUILD_TAG$file_ext
|
||||||
|
current_dir=`pwd`
|
||||||
|
release_dir="/dist/"
|
||||||
|
release_file=$current_dir$release_dir$file
|
||||||
|
|
||||||
|
smbclient //proxy/files 4738tax -U tkl -c "mkdir python ; cd python ; mkdir $CI_PROJECT_NAME ; cd $CI_PROJECT_NAME ; put $release_file $file"
|
1
scripts/pylint_wrapper.py
Normal file → Executable file
1
scripts/pylint_wrapper.py
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
'''
|
'''
|
||||||
Created on Feb 11, 2017
|
Created on Feb 11, 2017
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user