From 3bf9c535236ad9b24a4fd1bdacaacf0b876af36e Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 22 Mar 2017 22:35:55 +0100 Subject: [PATCH 1/5] Updated appveyor script to new setup. --- scripts/appveyor-webhook.py | 14 +++++++++----- scripts/appveyor.yml | 16 ++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/scripts/appveyor-webhook.py b/scripts/appveyor-webhook.py index fc844e265..ed0975956 100755 --- a/scripts/appveyor-webhook.py +++ b/scripts/appveyor-webhook.py @@ -35,8 +35,8 @@ import sys import time from subprocess import Popen, PIPE -appveyor_build_url = 'https://ci.appveyor.com/project/TomasGroth/openlp/build' -appveyor_api_url = 'https://ci.appveyor.com/api/projects/TomasGroth/openlp' +appveyor_build_url = 'https://ci.appveyor.com/project/OpenLP/{project}/build' +appveyor_api_url = 'https://ci.appveyor.com/api/projects/OpenLP/{project}' webhook_element = \ { @@ -119,11 +119,15 @@ def get_appveyor_build_url(branch): """ Get the url of the build. """ - responce = urllib.request.urlopen(appveyor_api_url) + if 'openlp-core/openlp/trunk' in branch: + project = 'trunk' + else: + project = 'dev' + responce = urllib.request.urlopen(appveyor_api_url.format(project=project)) json_str = responce.read().decode('utf-8') build_json = json.loads(json_str) - build_url = '%s/%s' % (appveyor_build_url, build_json['build']['version']) - print('Check this URL for build status: %s' % build_url) + build_url = '%s/%s' % (appveyor_build_url.format(project=project), build_json['build']['version']) + print('Check this URL for build status: %s' % build_url.format(project=project)) if len(sys.argv) != 3: diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 27b4cfc98..717d8d6cb 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -12,21 +12,21 @@ environment: install: # Install dependencies from pypi - - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic chardet beautifulsoup4 Mako nose mock pyodbc psycopg2 pypiwin32 pyenchant" + - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic chardet beautifulsoup4 Mako nose mock pyodbc==4.0.8 psycopg2 pypiwin32 pyenchant" # Install mysql dependency - "%PYTHON%\\python.exe -m pip install http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df" # Download and install lxml and pyicu (originally from http://www.lfd.uci.edu/~gohlke/pythonlibs/) - "%PYTHON%\\python.exe -m pip install https://get.openlp.org/win-sdk/lxml-3.6.4-cp34-cp34m-win32.whl" - "%PYTHON%\\python.exe -m pip install https://get.openlp.org/win-sdk/PyICU-1.9.5-cp34-cp34m-win32.whl" # Download and install PyQt5 - - curl -L -O http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.5.1/PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe + - appveyor DownloadFile http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.5.1/PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe - PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe /S # Download and unpack mupdf - - curl -O http://mupdf.com/downloads/archive/mupdf-1.9a-windows.zip + - appveyor DownloadFile http://mupdf.com/downloads/archive/mupdf-1.9a-windows.zip - 7z x mupdf-1.9a-windows.zip - cp mupdf-1.9a-windows/mupdf.exe openlp-branch/mupdf.exe # Download and unpack mediainfo - - curl -O https://mediaarea.net/download/binary/mediainfo/0.7.90/MediaInfo_CLI_0.7.90_Windows_i386.zip + - appveyor DownloadFile https://mediaarea.net/download/binary/mediainfo/0.7.90/MediaInfo_CLI_0.7.90_Windows_i386.zip - mkdir MediaInfo - 7z x -oMediaInfo MediaInfo_CLI_0.7.90_Windows_i386.zip - cp MediaInfo\\MediaInfo.exe openlp-branch\\MediaInfo.exe @@ -43,15 +43,15 @@ test_script: after_test: # This is where we create a package using PyInstaller # First get PyInstaller - - curl -L -O https://github.com/pyinstaller/pyinstaller/releases/download/v3.2/PyInstaller-3.2.zip + - appveyor DownloadFile https://github.com/pyinstaller/pyinstaller/releases/download/v3.2/PyInstaller-3.2.zip - 7z x PyInstaller-3.2.zip # Install PyInstaller dependencies - "%PYTHON%\\python.exe -m pip install future pefile" # Download and install Inno Setup - used for packaging - - curl -L -O http://www.jrsoftware.org/download.php/is-unicode.exe + - appveyor DownloadFile http://www.jrsoftware.org/download.php/is-unicode.exe - is-unicode.exe /VERYSILENT /SUPPRESSMSGBOXES /SP- # Download and unpack portable-bundle - - curl -O https://get.openlp.org/win-sdk/portable-setup.7z + - appveyor DownloadFile https://get.openlp.org/win-sdk/portable-setup.7z - 7z x portable-setup.7z # Disabled portable installers - can't figure out how to make them silent # - curl -L -O http://downloads.sourceforge.net/project/portableapps/PortableApps.com%20Installer/PortableApps.comInstaller_3.4.4.paf.exe @@ -61,7 +61,7 @@ after_test: # - curl -L -O http://downloads.sourceforge.net/project/portableapps/NSIS%20Portable/NSISPortable_3.0_English.paf.exe # - NSISPortable_3.0_English.paf.exe /S # Get the packaging code - - curl -L http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -o packaging.tar.gz + - appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz - 7z e packaging.tar.gz - 7z x packaging.tar - mv ~openlp-core/openlp/packaging packaging From 97c33fde46faeb34b5716b8a3f41afff18226f4f Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 23 Mar 2017 20:36:09 +0100 Subject: [PATCH 2/5] Fix test. --- .../openlp_plugins/bibles/forms/__init__.py | 21 +++++++++++++++++++ .../bibles/forms/test_bibleimportform.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/interfaces/openlp_plugins/bibles/forms/__init__.py diff --git a/tests/interfaces/openlp_plugins/bibles/forms/__init__.py b/tests/interfaces/openlp_plugins/bibles/forms/__init__.py new file mode 100644 index 000000000..ea62548f4 --- /dev/null +++ b/tests/interfaces/openlp_plugins/bibles/forms/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2017 OpenLP Developers # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### diff --git a/tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py b/tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py index 4f821d601..fe1b18291 100644 --- a/tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py +++ b/tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py @@ -47,7 +47,7 @@ class TestBibleImportForm(TestCase, TestMixin): self.main_window = QtWidgets.QMainWindow() Registry().register('main_window', self.main_window) bibleimportform.PYSWORD_AVAILABLE = False - self.form = bibleimportform.BibleImportForm(self.main_window, MagicMock(), MagicMock()) + self.form = bibleimportform.BibleImportForm(None, MagicMock(), MagicMock()) def tearDown(self): """ From a57a12441bccad22ffa99cc1ff17c10ae151641a Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 3 May 2017 20:40:30 +0200 Subject: [PATCH 3/5] Fix and improvements to appveyor build script --- scripts/appveyor-webhook.py | 11 ++++++----- scripts/appveyor.yml | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/appveyor-webhook.py b/scripts/appveyor-webhook.py index ed0975956..976745a35 100755 --- a/scripts/appveyor-webhook.py +++ b/scripts/appveyor-webhook.py @@ -84,7 +84,7 @@ def get_version(): return version_string, version -def get_yml(branch): +def get_yml(branch, build_docs): """ Returns the content of appveyor.yml and inserts the branch to be build """ @@ -92,7 +92,7 @@ def get_yml(branch): yml_text = f.read() f.close() yml_text = yml_text.replace('BRANCHNAME', branch) - if 'openlp-core/openlp/trunk' in branch: + if build_docs: yml_text = yml_text.replace('BUILD_DOCS', '$TRUE') else: yml_text = yml_text.replace('BUILD_DOCS', '$FALSE') @@ -130,12 +130,13 @@ def get_appveyor_build_url(branch): print('Check this URL for build status: %s' % build_url.format(project=project)) -if len(sys.argv) != 3: - print('Usage: %s ' % sys.argv[0]) +if len(sys.argv) != 4: + print('Usage: %s ' % sys.argv[0]) else: webhook_url = sys.argv[1] branch = sys.argv[2] - hook(webhook_url, get_yml(branch)) + build_docs = sys.argv[3].upper() == 'TRUE' + hook(webhook_url, get_yml(branch, build_docs)) # Wait 5 seconds to make sure the hook has been triggered time.sleep(5) get_appveyor_build_url(branch) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 717d8d6cb..109eca8e5 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -36,7 +36,7 @@ build: off test_script: - cd openlp-branch # Run the tests - - "%PYTHON%\\python.exe -m nose -v tests" + #- "%PYTHON%\\python.exe -m nose -v tests" # Go back to the user root folder - cd.. @@ -74,7 +74,7 @@ after_test: 7z x documentation.tar mv ~openlp-core/openlp/documentation documentation cd packaging - &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch -d ../documentation --portable + &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update -c windows/config-appveyor.ini -b ../openlp-branch -d ../documentation --portable } else { cd packaging &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch --portable From b98468e4ddd62625e29c570b5fb511380a4a5672 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 3 May 2017 22:16:52 +0200 Subject: [PATCH 4/5] More fixes for appveyor scripts. --- scripts/appveyor-webhook.py | 29 +++++++++++++++-------------- scripts/appveyor.yml | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/scripts/appveyor-webhook.py b/scripts/appveyor-webhook.py index 976745a35..630c404d7 100755 --- a/scripts/appveyor-webhook.py +++ b/scripts/appveyor-webhook.py @@ -37,6 +37,7 @@ from subprocess import Popen, PIPE appveyor_build_url = 'https://ci.appveyor.com/project/OpenLP/{project}/build' appveyor_api_url = 'https://ci.appveyor.com/api/projects/OpenLP/{project}' +appveyor_log_url = 'https://ci.appveyor.com/api/buildjobs/{buildid}/log' webhook_element = \ { @@ -84,7 +85,7 @@ def get_version(): return version_string, version -def get_yml(branch, build_docs): +def get_yml(branch, build_type): """ Returns the content of appveyor.yml and inserts the branch to be build """ @@ -92,7 +93,7 @@ def get_yml(branch, build_docs): yml_text = f.read() f.close() yml_text = yml_text.replace('BRANCHNAME', branch) - if build_docs: + if build_type in ['openlp', 'trunk']: yml_text = yml_text.replace('BUILD_DOCS', '$TRUE') else: yml_text = yml_text.replace('BUILD_DOCS', '$FALSE') @@ -115,28 +116,28 @@ def hook(webhook_url, yml): print(responce.read().decode('utf-8')) -def get_appveyor_build_url(branch): +def get_appveyor_build_url(build_type): """ Get the url of the build. """ - if 'openlp-core/openlp/trunk' in branch: - project = 'trunk' - else: - project = 'dev' - responce = urllib.request.urlopen(appveyor_api_url.format(project=project)) + responce = urllib.request.urlopen(appveyor_api_url.format(project=build_type)) json_str = responce.read().decode('utf-8') build_json = json.loads(json_str) - build_url = '%s/%s' % (appveyor_build_url.format(project=project), build_json['build']['version']) - print('Check this URL for build status: %s' % build_url.format(project=project)) + build_url = '%s/%s' % (appveyor_build_url.format(project=build_type), build_json['build']['version']) + print(build_url.format(project=build_type)) + print(appveyor_log_url.format(buildid=build_json['build']['jobs'][0]['jobId'])) if len(sys.argv) != 4: - print('Usage: %s ' % sys.argv[0]) + print('Invalid number of arguments\nUsage: %s ' % sys.argv[0]) else: webhook_url = sys.argv[1] branch = sys.argv[2] - build_docs = sys.argv[3].upper() == 'TRUE' - hook(webhook_url, get_yml(branch, build_docs)) + build_type = sys.argv[3] + if build_type not in ['dev', 'trunk', 'openlp']: + print('Invalid build type\nUsage: %s ' % sys.argv[0]) + exit() + hook(webhook_url, get_yml(branch, build_type)) # Wait 5 seconds to make sure the hook has been triggered time.sleep(5) - get_appveyor_build_url(branch) + get_appveyor_build_url(build_type) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 109eca8e5..3d2ceda21 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -36,7 +36,7 @@ build: off test_script: - cd openlp-branch # Run the tests - #- "%PYTHON%\\python.exe -m nose -v tests" + - "%PYTHON%\\python.exe -m nose -v tests" # Go back to the user root folder - cd.. From 0fc912bd8fc0aa0b80154b4b673b20fb1dbc3c85 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 4 May 2017 23:53:50 +0200 Subject: [PATCH 5/5] Updated jenkins script to match new setup. --- scripts/jenkins_script.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/jenkins_script.py b/scripts/jenkins_script.py index a11225f15..5b8c61950 100755 --- a/scripts/jenkins_script.py +++ b/scripts/jenkins_script.py @@ -59,14 +59,13 @@ class OpenLPJobs(object): Branch_Pull = 'Branch-01-Pull' Branch_Functional = 'Branch-02-Functional-Tests' Branch_Interface = 'Branch-03-Interface-Tests' - Branch_Windows_Functional = 'Branch-04a-Windows_Functional_Tests' - Branch_Windows_Interface = 'Branch-04b-Windows_Interface_Tests' - Branch_PEP = 'Branch-05a-Code_Analysis' - Branch_Coverage = 'Branch-05b-Test_Coverage' - Branch_Pylint = 'Branch-05c-Code_Analysis2' + Branch_PEP = 'Branch-04a-Code_Analysis' + Branch_Coverage = 'Branch-04b-Test_Coverage' + Branch_Pylint = 'Branch-04c-Code_Analysis2' + Branch_AppVeyor = 'Branch-05-AppVeyor-Tests' - Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_Windows_Functional, Branch_Windows_Interface, - Branch_PEP, Branch_Coverage, Branch_Pylint] + Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_PEP, Branch_Coverage, Branch_Pylint, + Branch_AppVeyor] class Colour(object):