Change appveyor integration to not rely on bzr.

This commit is contained in:
Tomas Groth 2018-07-14 21:56:11 +02:00
parent 6a8bf83d27
commit 6adf749e99
2 changed files with 14 additions and 12 deletions

View File

@ -92,21 +92,24 @@ def get_yml(branch, build_type):
f = open('appveyor.yml') f = open('appveyor.yml')
yml_text = f.read() yml_text = f.read()
f.close() f.close()
yml_text = yml_text.replace('BRANCHNAME', branch) version_string, version = get_version()
yml_text = yml_text.replace('TAG', version_string)
if build_type in ['openlp', 'trunk']: if build_type in ['openlp', 'trunk']:
yml_text = yml_text.replace('BRANCHPATH', '~openlp-core/openlp/trunk')
yml_text = yml_text.replace('BUILD_DOCS', '$TRUE') yml_text = yml_text.replace('BUILD_DOCS', '$TRUE')
else: else:
yml_text = yml_text.replace('BRANCHPATH', branch.split(':')[1])
yml_text = yml_text.replace('BUILD_DOCS', '$FALSE') yml_text = yml_text.replace('BUILD_DOCS', '$FALSE')
return yml_text return yml_text, version_string
def hook(webhook_url, yml): def hook(webhook_url, branch, build_type):
""" """
Activate the webhook to start the build Activate the webhook to start the build
""" """
yml, version_string = get_yml(branch, build_type)
webhook_element['config'] = yml webhook_element['config'] = yml
webhook_element['commit']['message'] = 'Building ' + branch webhook_element['commit']['message'] = 'Building ' + branch
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)
request.add_header('Content-Type', 'application/json;charset=utf-8') request.add_header('Content-Type', 'application/json;charset=utf-8')
@ -137,7 +140,7 @@ else:
if build_type not in ['dev', 'trunk', 'openlp']: if build_type not in ['dev', 'trunk', 'openlp']:
print('Invalid build type\nUsage: %s <webhook-url> <branch> <dev|trunk|openlp>' % sys.argv[0]) print('Invalid build type\nUsage: %s <webhook-url> <branch> <dev|trunk|openlp>' % sys.argv[0])
exit() exit()
hook(webhook_url, get_yml(branch, build_type)) hook(webhook_url, branch, build_type)
# Wait 5 seconds to make sure the hook has been triggered # Wait 5 seconds to make sure the hook has been triggered
time.sleep(5) time.sleep(5)
get_appveyor_build_url(build_type) get_appveyor_build_url(build_type)

View File

@ -1,11 +1,10 @@
version: OpenLP-win-ci-b{build} version: OpenLP-win-ci-b{build}
init:
- choco install -y --force bzr
- set PATH=C:\Program Files (x86)\Bazaar;%PATH%
clone_script: clone_script:
- bzr checkout --lightweight BRANCHNAME openlp-branch - curl -L https://bazaar.launchpad.net/~tomasgroth/openlp/pco-24/tarball -o pco.tar.gz
- 7z e pco.tar.gz
- 7z x pco.tar
- mv ~tomasgroth/openlp/pco-24 openlp-branch
environment: environment:
PYTHON: C:\\Python34 PYTHON: C:\\Python34
@ -74,10 +73,10 @@ after_test:
7z x documentation.tar 7z x documentation.tar
mv ~openlp-core/openlp/documentation documentation mv ~openlp-core/openlp/documentation documentation
cd packaging cd packaging
&"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update -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 --tag-override TAG
} else { } else {
cd packaging cd packaging
&"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch --portable &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch --portable --tag-override TAG
} }
artifacts: artifacts: