More work on appveyor

This commit is contained in:
Tomas Groth 2016-11-29 21:37:39 +01:00
parent 8595a2171f
commit 1f4c8e742e
2 changed files with 113 additions and 16 deletions

102
scripts/appveyor-webhook.py Executable file
View File

@ -0,0 +1,102 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 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 #
###############################################################################
import json
import urllib
import urllib.request
import datetime
import sys
from subprocess import Popen, PIPE
token = 'xx'
webhook_url = 'https://ci.appveyor.com/api/subversion/webhook?id=x'
branch = 'lp:openlp'
webhook_element = \
{
"commit": {
"author": {
"email": "open@contributer",
"name": "OpenLP Contributor"
},
"id": None,
"message": "Building " + branch,
"timestamp": datetime.datetime.now().isoformat()
},
"config": None,
"repository": {
"name": "repo_name",
"url": "repo_url"
}
}
def get_version():
"""
Get the version of the branch.
"""
bzr = Popen(('bzr', 'tags'), stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
raise Exception('Error running bzr tags')
lines = output.splitlines()
if len(lines) == 0:
tag = '0.0.0'
revision = '0'
else:
tag, revision = lines[-1].decode('utf-8').split()
bzr = Popen(('bzr', 'log', '--line', '-r', '-1'), stdout=PIPE)
output, error = bzr.communicate()
code = bzr.wait()
if code != 0:
raise Exception('Error running bzr log')
latest = output.decode('utf-8').split(':')[0]
version_string = latest == revision and tag or '%s-bzr%s' % (tag, latest)
# Save decimal version in case we need to do a portable build.
version = latest == revision and tag or '%s.%s' % (tag, latest)
return version_string, version
def get_yml():
f = open('appveyor.yml')
yml_text = f.read()
f.close()
yml_text = yml_text.replace('BRANCHNAME', branch)
return yml_text
def hook(token, webhook_url):
webhook_element['config'] = get_yml()
webhook_element['commit']['message'] = 'Building ' + branch
version_string, version = get_version()
webhook_element['commit']['id'] = version_string
request = urllib.request.Request(webhook_url)
print(json.dumps(webhook_element))
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'))
print(responce.read().decode('utf-8'))
hook(token, webhook_url)

View File

@ -6,21 +6,21 @@ init:
- bzr --version - bzr --version
clone_script: clone_script:
- bzr checkout --lightweight lp:openlp openlp - bzr checkout --lightweight BRANCHNAME openlp
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==3.0.10 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 - 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 lxml-3.6.4-cp34-cp34m-win32.whl - "%PYTHON%\\python.exe -m pip install lxml-3.6.4-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 - 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 - "%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
@ -37,9 +37,7 @@ install:
# 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
- cd MediaInfo - 7z x -oMediaInfo MediaInfo_CLI_0.7.90_Windows_i386.zip
- 7z x ../MediaInfo_CLI_0.7.90_Windows_i386.zip
- cd..
- cp MediaInfo\\MediaInfo.exe openlp\\MediaInfo.exe - cp MediaInfo\\MediaInfo.exe openlp\\MediaInfo.exe
# 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
@ -54,15 +52,12 @@ build: off
test_script: test_script:
- cd openlp - cd openlp
- %PYTHON%\\python.exe -m nose -v tests - "%PYTHON%\\python.exe -m nose -v tests"
after_test: after_test:
# This is where we create a package using PyInstaller # This is where we create a package using PyInstaller
# First download and unpack PyInstaller # First get PyInstaller
- curl -L -O https://github.com/pyinstaller/pyinstaller/archive/develop.zip - curl -O https://github.com/pyinstaller/pyinstaller/archive/develop.zip
- 7z x develop.zip - 7z x develop.zip
# Then get the packaging repo # Build the bundle
- bzr checkout --lightweight lp:~tomasgroth/openlp/packaging-appveyor packaging - "%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.ini -b ..\\openlp