improve set_build.py, pin torba version
- adds BUILD_COMMIT to lbrynet.build_type
This commit is contained in:
parent
1efa2c9406
commit
925e39c5a8
6 changed files with 42 additions and 36 deletions
17
.travis.yml
17
.travis.yml
|
@ -3,6 +3,9 @@ dist: xenial
|
||||||
language: python
|
language: python
|
||||||
python: "3.7"
|
python: "3.7"
|
||||||
|
|
||||||
|
env:
|
||||||
|
- TORBA=master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
|
|
||||||
|
@ -10,7 +13,7 @@ jobs:
|
||||||
name: "pylint lbrynet"
|
name: "pylint lbrynet"
|
||||||
install:
|
install:
|
||||||
- pip install astroid pylint
|
- pip install astroid pylint
|
||||||
- pip install git+https://github.com/lbryio/torba.git@master#egg=torba
|
- pip install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||||
- pip install -e .
|
- pip install -e .
|
||||||
script: pylint lbrynet
|
script: pylint lbrynet
|
||||||
|
|
||||||
|
@ -18,7 +21,7 @@ jobs:
|
||||||
name: "Unit Tests"
|
name: "Unit Tests"
|
||||||
install:
|
install:
|
||||||
- pip install coverage
|
- pip install coverage
|
||||||
- pip install git+https://github.com/lbryio/torba.git@master#egg=torba
|
- pip install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||||
- pip install -e .
|
- pip install -e .
|
||||||
script:
|
script:
|
||||||
- HOME=/tmp coverage run -p --source=lbrynet -m unittest discover -vv tests.unit
|
- HOME=/tmp coverage run -p --source=lbrynet -m unittest discover -vv tests.unit
|
||||||
|
@ -27,10 +30,10 @@ jobs:
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
- name: "Integration Tests"
|
- name: "Integration Tests"
|
||||||
cache: false
|
|
||||||
install:
|
install:
|
||||||
- pip install tox-travis coverage
|
- pip install tox-travis coverage
|
||||||
- pushd .. && git clone --single-branch --branch master https://github.com/lbryio/torba.git && popd
|
- pushd .. && git clone --single-branch --branch ${TORBA} https://github.com/lbryio/torba.git && popd
|
||||||
|
|
||||||
script: tox
|
script: tox
|
||||||
after_success:
|
after_success:
|
||||||
- coverage combine tests/
|
- coverage combine tests/
|
||||||
|
@ -39,7 +42,7 @@ jobs:
|
||||||
- name: "Run Examples"
|
- name: "Run Examples"
|
||||||
install:
|
install:
|
||||||
- pip install coverage
|
- pip install coverage
|
||||||
- pip install git+https://github.com/lbryio/torba.git@master#egg=torba
|
- pip install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||||
- pip install -e .
|
- pip install -e .
|
||||||
script:
|
script:
|
||||||
- HOME=/tmp coverage run -p --source=lbrynet scripts/generate_json_api.py
|
- HOME=/tmp coverage run -p --source=lbrynet scripts/generate_json_api.py
|
||||||
|
@ -56,7 +59,7 @@ jobs:
|
||||||
- docker pull lbry/pyinstaller34_32bits:py371
|
- docker pull lbry/pyinstaller34_32bits:py371
|
||||||
script:
|
script:
|
||||||
- python scripts/set_build.py
|
- python scripts/set_build.py
|
||||||
- docker run -v "$(pwd):/src/lbry" lbry/pyinstaller34_32bits:py371 lbry/scripts/wine_build.sh
|
- docker run -v "$(pwd):/src/lbry" lbry/pyinstaller34_32bits:py371 lbry/scripts/wine_build.sh ${TORBA}
|
||||||
- sudo zip -j dist/lbrynet-windows.zip dist/lbrynet.exe
|
- sudo zip -j dist/lbrynet-windows.zip dist/lbrynet.exe
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
@ -80,7 +83,7 @@ jobs:
|
||||||
env: OS=linux
|
env: OS=linux
|
||||||
install:
|
install:
|
||||||
- pip3 install pyinstaller
|
- pip3 install pyinstaller
|
||||||
- pip3 install git+https://github.com/lbryio/torba.git
|
- pip3 install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||||
- python3 scripts/set_build.py
|
- python3 scripts/set_build.py
|
||||||
- pip3 install -e .
|
- pip3 install -e .
|
||||||
script:
|
script:
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
# don't touch this. CI server changes this during build/deployment
|
# don't touch this. CI server changes this during build/deployment
|
||||||
BUILD = "dev"
|
BUILD = "dev"
|
||||||
|
BUILD_COMMIT = "source installation"
|
||||||
|
|
|
@ -1,33 +1,35 @@
|
||||||
|
"""Set the build version to be 'qa', 'rc', 'release'"""
|
||||||
|
|
||||||
"""Set the build version to be 'dev', 'qa', 'rc', 'release'"""
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
import re
|
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import logging
|
||||||
|
|
||||||
|
log = logging.getLogger()
|
||||||
|
log.addHandler(logging.StreamHandler())
|
||||||
|
log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
def get_build_type(travis_tag=None):
|
||||||
|
if not travis_tag:
|
||||||
|
return "qa"
|
||||||
|
log.debug("getting build type for tag: \"%s\"", travis_tag)
|
||||||
|
if re.match('v\d+\.\d+\.\d+rc\d+$', travis_tag):
|
||||||
|
return 'rc'
|
||||||
|
elif re.match('v\d+\.\d+\.\d+$', travis_tag):
|
||||||
|
return 'release'
|
||||||
|
return 'qa'
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
build = get_build()
|
|
||||||
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
with open(os.path.join(root_dir, 'lbrynet', 'build_type.py'), 'w') as f:
|
build_type_path = os.path.join(root_dir, 'lbrynet', 'build_type.py')
|
||||||
f.write("BUILD = '{}'\n".format(build))
|
log.debug("configuring build type file: %s", build_type_path)
|
||||||
|
travis_commit = os.environ['TRAVIS_COMMIT'][:6]
|
||||||
|
build_type = get_build_type(os.environ.get('TRAVIS_TAG', None))
|
||||||
def get_build():
|
log.debug("setting build type=%s, build commit=%s", build_type, travis_commit)
|
||||||
try:
|
with open(build_type_path, 'w') as f:
|
||||||
tag = subprocess.check_output(['git', 'describe', '--exact-match', '--all']).strip()
|
f.write("BUILD = \"{}\"\nBUILD_COMMIT = \"{}\"\n".format(build_type, travis_commit))
|
||||||
if re.match('tags\/v\d+\.\d+\.\d+rc\d+$', tag.decode()):
|
|
||||||
print('Build: rc')
|
|
||||||
return 'rc'
|
|
||||||
elif re.match('tags\/v\d+\.\d+\.\d+$', tag.decode()):
|
|
||||||
print('Build: release')
|
|
||||||
return 'release'
|
|
||||||
print('Build: qa')
|
|
||||||
return 'qa'
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
print("Couldn't determine build type, defaulting to qa.")
|
|
||||||
return 'qa'
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
set -x
|
set -x
|
||||||
|
TORBA=$1
|
||||||
rm -rf /tmp/.wine-*
|
rm -rf /tmp/.wine-*
|
||||||
|
|
||||||
apt-get -qq update
|
apt-get -qq update
|
||||||
apt-get -qq install -y git
|
apt-get -qq install -y git
|
||||||
|
|
||||||
pip install setuptools_scm
|
pip install setuptools_scm
|
||||||
git clone https://github.com/lbryio/torba.git --depth 1
|
|
||||||
cd torba && pip install -e . && cd ..
|
|
||||||
|
|
||||||
cd lbry
|
cd lbry
|
||||||
|
|
||||||
|
@ -15,6 +12,8 @@ cd lbry
|
||||||
wget -Onetifaces-0.10.7-cp37-cp37m-win32.whl https://ci.appveyor.com/api/buildjobs/6hworunifsymrhp2/artifacts/dist%2Fnetifaces-0.10.7-cp37-cp37m-win32.whl
|
wget -Onetifaces-0.10.7-cp37-cp37m-win32.whl https://ci.appveyor.com/api/buildjobs/6hworunifsymrhp2/artifacts/dist%2Fnetifaces-0.10.7-cp37-cp37m-win32.whl
|
||||||
pip install netifaces-0.10.7-cp37-cp37m-win32.whl
|
pip install netifaces-0.10.7-cp37-cp37m-win32.whl
|
||||||
|
|
||||||
|
pip install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||||
|
|
||||||
pip install -e .
|
pip install -e .
|
||||||
pip install pywin32
|
pip install pywin32
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -23,7 +23,7 @@ setup(
|
||||||
'console_scripts': 'lbrynet=lbrynet.extras.cli:main'
|
'console_scripts': 'lbrynet=lbrynet.extras.cli:main'
|
||||||
},
|
},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'torba',
|
'torba==0.5.4',
|
||||||
'aiohttp==3.5.4',
|
'aiohttp==3.5.4',
|
||||||
'aioupnp',
|
'aioupnp',
|
||||||
'appdirs==1.4.3',
|
'appdirs==1.4.3',
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -5,6 +5,7 @@ envlist = py37-integration
|
||||||
deps =
|
deps =
|
||||||
coverage
|
coverage
|
||||||
../torba
|
../torba
|
||||||
|
|
||||||
extras = test
|
extras = test
|
||||||
changedir = {toxinidir}/tests
|
changedir = {toxinidir}/tests
|
||||||
setenv =
|
setenv =
|
||||||
|
|
Loading…
Reference in a new issue