Merge pull request #273 from lbryio/test-build-type

set build type in travis
This commit is contained in:
Alex Grin 2016-11-15 23:01:15 -05:00 committed by GitHub
commit a2e648fcfc
3 changed files with 24 additions and 3 deletions

View file

@ -27,7 +27,7 @@ cache:
before_install: before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./packaging/travis/setup_osx.sh; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./packaging/travis/setup_osx.sh; fi
- mkdir -p lbrynet/resources/ui - mkdir -p lbrynet/resources/ui
- ./packaging/travis/setup_qa.sh - ./packaging/travis/setup_build.sh
install: install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./packaging/travis/install_dependencies_and_run_tests.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./packaging/travis/install_dependencies_and_run_tests.sh; fi

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Configure the library for a non-production release # Configure build-specific things
# #
set -euo pipefail set -euo pipefail
@ -13,12 +13,23 @@ add_ui() {
wget https://s3.amazonaws.com/lbry-ui/development/data.json -O lbrynet/resources/ui/data.json wget https://s3.amazonaws.com/lbry-ui/development/data.json -O lbrynet/resources/ui/data.json
} }
set_build() {
local file="lbrynet/build_type.py"
# cannot use 'sed -i' because BSD sed and GNU sed are incompatible
sed 's/^\(BUILD = "\)[^"]\+\(".*\)$/\1'"${1}"'\2/' "$file" > tmpbuildfile
mv -- tmpbuildfile "$file"
}
IS_RC_REGEX="v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+-rc[[:digit:]]+" IS_RC_REGEX="v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+-rc[[:digit:]]+"
if [[ -z "$TRAVIS_TAG" ]]; then if [[ -z "$TRAVIS_TAG" ]]; then
python packaging/append_sha_to_version.py lbrynet/__init__.py "${TRAVIS_COMMIT}" python packaging/append_sha_to_version.py lbrynet/__init__.py "${TRAVIS_COMMIT}"
add_ui add_ui
set_build "qa"
elif [[ "$TRAVIS_TAG" =~ $IS_RC_REGEX ]]; then elif [[ "$TRAVIS_TAG" =~ $IS_RC_REGEX ]]; then
# If the tag looks like v0.7.6-rc0 then this is a tagged release candidate. # If the tag looks like v0.7.6-rc0 then this is a tagged release candidate.
add_ui add_ui
set_build "rc"
else
set_build "release"
fi fi

View file

@ -1,4 +1,4 @@
# this is a port of setup_qa.sh used for the unix platforms # this is a port of setup_build.sh used for the unix platforms
function AddUi { function AddUi {
wget https://s3.amazonaws.com/lbry-ui/development/dist.zip -OutFile dist.zip wget https://s3.amazonaws.com/lbry-ui/development/dist.zip -OutFile dist.zip
@ -11,14 +11,24 @@ function AddUi {
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
} }
function SetBuild([string]$build) {
(Get-Content lbrynet\build_type.py).replace('dev', $build) | Set-Content lbrynet\build_type.py
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
If (${Env:APPVEYOR_REPO_TAG} -NotMatch "true") { If (${Env:APPVEYOR_REPO_TAG} -NotMatch "true") {
C:\Python27\python.exe packaging\append_sha_to_version.py lbrynet\__init__.py ${Env:APPVEYOR_REPO_COMMIT} C:\Python27\python.exe packaging\append_sha_to_version.py lbrynet\__init__.py ${Env:APPVEYOR_REPO_COMMIT}
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
AddUi AddUi
SetBuild "qa"
} }
ElseIf (${Env:APPVEYOR_REPO_TAG_NAME} -Match "v\d+\.\d+\.\d+-rc\d+") { ElseIf (${Env:APPVEYOR_REPO_TAG_NAME} -Match "v\d+\.\d+\.\d+-rc\d+") {
AddUi AddUi
SetBuild "rc"
}
Else {
SetBuild "release"
} }
C:\Python27\python.exe setup.py build bdist_msi C:\Python27\python.exe setup.py build bdist_msi