forked from openlp/openlp
More appveyor adjustments
This commit is contained in:
parent
bbda32b949
commit
105edf36c3
@ -21,32 +21,38 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
"""
|
||||||
|
This script is used to trigger a build at appveyor. Since the code is not hosted
|
||||||
|
on github the normal triggering mechanisms can't be use. The project is
|
||||||
|
registered as subversion repository. A webhook is used to trigger new builds.
|
||||||
|
The appveyor.yml used for the build is send to appveyor when calling the hook.
|
||||||
|
"""
|
||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import datetime
|
import datetime
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
token = 'xx'
|
appveyor_build_url = 'https://ci.appveyor.com/project/TomasGroth/openlp/build'
|
||||||
webhook_url = 'https://ci.appveyor.com/api/subversion/webhook?id=x'
|
appveyor_api_url = 'https://ci.appveyor.com/api/projects/TomasGroth/openlp'
|
||||||
branch = 'lp:openlp'
|
|
||||||
|
|
||||||
webhook_element = \
|
webhook_element = \
|
||||||
{
|
{
|
||||||
"commit": {
|
'commit': {
|
||||||
"author": {
|
'author': {
|
||||||
"email": "open@contributer",
|
'email': 'open@contributer',
|
||||||
"name": "OpenLP Contributor"
|
'name': 'OpenLP Contributor'
|
||||||
},
|
},
|
||||||
"id": None,
|
'id': None,
|
||||||
"message": "Building " + branch,
|
'message': None,
|
||||||
"timestamp": datetime.datetime.now().isoformat()
|
'timestamp': datetime.datetime.now().isoformat()
|
||||||
},
|
},
|
||||||
"config": None,
|
'config': None,
|
||||||
"repository": {
|
'repository': {
|
||||||
"name": "repo_name",
|
'name': 'repo_name',
|
||||||
"url": "repo_url"
|
'url': 'repo_url'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +84,10 @@ def get_version():
|
|||||||
return version_string, version
|
return version_string, version
|
||||||
|
|
||||||
|
|
||||||
def get_yml():
|
def get_yml(branch):
|
||||||
|
"""
|
||||||
|
Returns the content of appveyor.yml and inserts the branch to be build
|
||||||
|
"""
|
||||||
f = open('appveyor.yml')
|
f = open('appveyor.yml')
|
||||||
yml_text = f.read()
|
yml_text = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
@ -86,17 +95,39 @@ def get_yml():
|
|||||||
return yml_text
|
return yml_text
|
||||||
|
|
||||||
|
|
||||||
def hook(token, webhook_url):
|
def hook(webhook_url, yml):
|
||||||
webhook_element['config'] = get_yml()
|
"""
|
||||||
|
Activate the webhook to start the build
|
||||||
|
"""
|
||||||
|
webhook_element['config'] = yml
|
||||||
webhook_element['commit']['message'] = 'Building ' + branch
|
webhook_element['commit']['message'] = 'Building ' + branch
|
||||||
version_string, version = get_version()
|
version_string, version = get_version()
|
||||||
webhook_element['commit']['id'] = version_string
|
webhook_element['commit']['id'] = version_string
|
||||||
request = urllib.request.Request(webhook_url)
|
request = urllib.request.Request(webhook_url)
|
||||||
print(json.dumps(webhook_element))
|
|
||||||
request.add_header('Content-Type', 'application/json;charset=utf-8')
|
request.add_header('Content-Type', 'application/json;charset=utf-8')
|
||||||
request.add_header('Authorization', 'Bearer ' + token)
|
|
||||||
responce = urllib.request.urlopen(request, json.dumps(webhook_element).encode('utf-8'))
|
responce = urllib.request.urlopen(request, json.dumps(webhook_element).encode('utf-8'))
|
||||||
|
if responce.getcode() != 204:
|
||||||
|
print('An error happened when calling the webhook! Return code: %d' % responce.getcode())
|
||||||
print(responce.read().decode('utf-8'))
|
print(responce.read().decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
hook(token, webhook_url)
|
def get_appveyor_build_url(branch):
|
||||||
|
"""
|
||||||
|
Get the url of the build.
|
||||||
|
"""
|
||||||
|
# Wait 10 seconds to make sure the hook has been triggered
|
||||||
|
time.sleep(10)
|
||||||
|
responce = urllib.request.urlopen(appveyor_api_url)
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
if len(sys.argv) != 3:
|
||||||
|
print('Usage: %s <webhook-url> <branch>' % sys.argv[0])
|
||||||
|
else:
|
||||||
|
webhook_url = sys.argv[1]
|
||||||
|
branch = sys.argv[2]
|
||||||
|
hook(webhook_url, get_yml(branch))
|
||||||
|
get_appveyor_build_url(branch)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: 2.5.0.{build}
|
version: OpenLP-win-ci-b{build}
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- choco install -y --force bzr
|
- choco install -y --force bzr
|
||||||
@ -6,39 +6,54 @@ init:
|
|||||||
- bzr --version
|
- bzr --version
|
||||||
|
|
||||||
clone_script:
|
clone_script:
|
||||||
- bzr checkout --lightweight BRANCHNAME openlp
|
- bzr checkout --lightweight BRANCHNAME openlp-branch
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
PYTHON: C:\\Python34
|
PYTHON: C:\\Python34
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# Install dependencies from pypi
|
# Install dependencies from pypi
|
||||||
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic chardet beautifulsoup4 Mako nose mock pyodbc==3.0.10 psycopg2 pypiwin32 pyenchant"
|
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic chardet beautifulsoup4 Mako nose mock pyodbc psycopg2 pypiwin32 pyenchant"
|
||||||
# Install mysql dependency
|
# 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"
|
- "%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/)
|
# Download and install lxml and pyicu (originally from http://www.lfd.uci.edu/~gohlke/pythonlibs/)
|
||||||
- curl -L "https://www.dropbox.com/s/7dwwna459j6qvbp/lxml-3.6.4-cp34-cp34m-win32.whl?dl=1" -o lxml-3.6.4-cp34-cp34m-win32.whl
|
- "%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 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"
|
||||||
- curl -L "https://www.dropbox.com/s/ib1yq4xq7o1dma7/PyICU-1.9.5-cp34-cp34m-win32.whl?dl=1" -o PyICU-1.9.5-cp34-cp34m-win32.whl
|
|
||||||
- "%PYTHON%\\python.exe -m pip install PyICU-1.9.5-cp34-cp34m-win32.whl"
|
|
||||||
# Download and install PyQt5
|
# 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
|
- 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
|
||||||
- PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe /S
|
- PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe /S
|
||||||
# Download and install Inno Setup - used for packaging
|
|
||||||
- curl -L -O http://www.jrsoftware.org/download.php/is-unicode.exe
|
|
||||||
- is-unicode.exe /VERYSILENT /SUPPRESSMSGBOXES /SP-
|
|
||||||
# Download and unpack portable-bundle
|
|
||||||
- curl -L "https://www.dropbox.com/s/omr8mw9kamnml3l/portable-setup.7z?dl=1" -o portable-setup.7z
|
|
||||||
- 7z x portable-setup.7z
|
|
||||||
# Download and unpack mupdf
|
# Download and unpack mupdf
|
||||||
- curl -O http://mupdf.com/downloads/archive/mupdf-1.9a-windows.zip
|
- curl -O http://mupdf.com/downloads/archive/mupdf-1.9a-windows.zip
|
||||||
- 7z x mupdf-1.9a-windows.zip
|
- 7z x mupdf-1.9a-windows.zip
|
||||||
- cp mupdf-1.9a-windows/mupdf.exe openlp/mupdf.exe
|
- cp mupdf-1.9a-windows/mupdf.exe openlp-branch/mupdf.exe
|
||||||
# Download and unpack mediainfo
|
# Download and unpack mediainfo
|
||||||
- curl -O https://mediaarea.net/download/binary/mediainfo/0.7.90/MediaInfo_CLI_0.7.90_Windows_i386.zip
|
- curl -O https://mediaarea.net/download/binary/mediainfo/0.7.90/MediaInfo_CLI_0.7.90_Windows_i386.zip
|
||||||
- mkdir MediaInfo
|
- mkdir MediaInfo
|
||||||
- 7z x -oMediaInfo MediaInfo_CLI_0.7.90_Windows_i386.zip
|
- 7z x -oMediaInfo MediaInfo_CLI_0.7.90_Windows_i386.zip
|
||||||
- cp MediaInfo\\MediaInfo.exe openlp\\MediaInfo.exe
|
- cp MediaInfo\\MediaInfo.exe openlp-branch\\MediaInfo.exe
|
||||||
|
|
||||||
|
|
||||||
|
build: off
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- cd openlp-branch
|
||||||
|
- "%PYTHON%\\python.exe -m nose -v tests"
|
||||||
|
# Go back to the user root folder
|
||||||
|
- cd..
|
||||||
|
|
||||||
|
after_test:
|
||||||
|
# This is where we create a package using PyInstaller
|
||||||
|
# First get PyInstaller
|
||||||
|
- curl -L -O https://github.com/pyinstaller/pyinstaller/archive/develop.zip
|
||||||
|
- 7z x develop.zip
|
||||||
|
# Install PyInstaller dependencies
|
||||||
|
- "%PYTHON%\\python.exe -m pip install future"
|
||||||
|
# Download and install Inno Setup - used for packaging
|
||||||
|
- curl -L -O 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
|
||||||
|
- 7z x portable-setup.7z
|
||||||
# Disabled portable installers - can't figure out how to make them silent
|
# 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
|
# - curl -L -O http://downloads.sourceforge.net/project/portableapps/PortableApps.com%20Installer/PortableApps.comInstaller_3.4.4.paf.exe
|
||||||
# - PortableApps.comInstaller_3.4.4.paf.exe /S
|
# - PortableApps.comInstaller_3.4.4.paf.exe /S
|
||||||
@ -46,18 +61,11 @@ install:
|
|||||||
# - PortableApps.comLauncher_2.2.1.paf.exe /S
|
# - PortableApps.comLauncher_2.2.1.paf.exe /S
|
||||||
# - curl -L -O http://downloads.sourceforge.net/project/portableapps/NSIS%20Portable/NSISPortable_3.0_English.paf.exe
|
# - curl -L -O http://downloads.sourceforge.net/project/portableapps/NSIS%20Portable/NSISPortable_3.0_English.paf.exe
|
||||||
# - NSISPortable_3.0_English.paf.exe /S
|
# - NSISPortable_3.0_English.paf.exe /S
|
||||||
|
# Get the packaging code
|
||||||
|
- bzr checkout --lightweight lp:~tomasgroth/openlp/packaging-appveyor packaging
|
||||||
build: off
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- cd openlp
|
|
||||||
- "%PYTHON%\\python.exe -m nose -v tests"
|
|
||||||
|
|
||||||
after_test:
|
|
||||||
# This is where we create a package using PyInstaller
|
|
||||||
# First get PyInstaller
|
|
||||||
- curl -O https://github.com/pyinstaller/pyinstaller/archive/develop.zip
|
|
||||||
- 7z x develop.zip
|
|
||||||
# Build the bundle
|
# Build the bundle
|
||||||
- "%PYTHON%\\python.exe windows/windows-builder.py -v -u -t -c windows/config-appveyor.ini -b ../openlp"
|
- cd packaging
|
||||||
|
- "%PYTHON%\\python.exe windows/windows-builder.py -v -u -t -c windows/config-appveyor.ini -b ../openlp-branch"
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
- path: openlp-branch\dist\*.exe
|
||||||
|
Loading…
Reference in New Issue
Block a user