Print md5 of binary in ci

This commit is contained in:
Gres 2020-04-26 16:30:59 +03:00
parent 16ffc3307b
commit 94afaf9497
4 changed files with 18 additions and 0 deletions

View File

@ -55,3 +55,6 @@ c.run('{} {}/usr/share/applications/*.desktop {} -appimage -qmake={}/bin/qmake'.
linuxdeployqt_bin, install_dir, flags, qt_dir))
c.run('mv {}-{}*.AppImage "{}"'.format(app_name, app_version, artifact_path))
bin_path = install_dir + '/usr/bin/' + bin_name
c.print('>> Md5 {} {}'.format(bin_path, c.md5sum(bin_path)))

View File

@ -10,6 +10,7 @@ import multiprocessing
import platform
import re
import ast
import hashlib
print = functools.partial(print, flush=True)
@ -208,3 +209,13 @@ def apply_cmd_env(cmd):
print('>>> Changing env', key, '\nfrom\n',
os.environ[key], '\nto\n', value)
os.environ[key] = value
def md5sum(path):
if not os.path.exists(path):
return ''
md5 = hashlib.md5()
with open(path, 'rb') as f:
md5.update(f.read())
return md5.hexdigest()
return ''

View File

@ -18,6 +18,7 @@ pro_file = path.abspath(path.dirname(__file__) +
'/../../screen-translator.pro')
test_pro_file = path.abspath(path.dirname(__file__) +
'/../../tests/tests.pro')
bin_name = 'screen-translator'
app_version = 'testing'
with open(pro_file, 'r') as f:
match = re.search(r'VER=(.*)', f.read())

View File

@ -38,3 +38,6 @@ for f in glob(ssl_dir + '/bin/*.dll'):
shutil.copy(f, install_dir)
c.archive(c.get_folder_files(os.path.relpath(install_dir)), artifact_path)
bin_path = install_dir + '\\' + bin_name + '.exe'
c.print('>> Md5 {} {}'.format(bin_path, c.md5sum(bin_path)))