move build-related files into top-level dir

This commit is contained in:
Alex Grintsvayg 2019-11-21 14:16:10 -05:00 committed by Lex Berezhny
parent 60a85fadd3
commit 44f07fb81d
7 changed files with 36 additions and 37 deletions

View file

@ -70,15 +70,13 @@ test:json-api:
script: script:
- pip install pyinstaller - pip install pyinstaller
- pip install -e torba/. - pip install -e torba/.
- cd lbry - python3.7 docker/set_build.py
- python3.7 scripts/set_build.py - pip install -e lbry/.
- pip install -e . - pyinstaller --onefile --name lbrynet lbry/lbry/extras/cli.py
- pyinstaller --onefile --name lbrynet lbry/extras/cli.py - chmod +x dist/lbrynet
- cd dist - zip --junk-paths ${CI_PROJECT_DIR}/lbrynet-${OS}.zip dist/lbrynet # gitlab expects artifacts to be in $CI_PROJECT_DIR
- chmod +x lbrynet
- zip --junk-paths ${CI_PROJECT_DIR}/lbrynet-${OS}.zip lbrynet # gitlab expects artifacts to be in $CI_PROJECT_DIR
- openssl dgst -sha256 ${CI_PROJECT_DIR}/lbrynet-${OS}.zip | egrep -o [0-9a-f]+$ # get sha256 of asset. works on mac and ubuntu - openssl dgst -sha256 ${CI_PROJECT_DIR}/lbrynet-${OS}.zip | egrep -o [0-9a-f]+$ # get sha256 of asset. works on mac and ubuntu
- ./lbrynet --version - dist/lbrynet --version
build:linux: build:linux:
extends: .build extends: .build
@ -116,7 +114,7 @@ build:windows:
OS: windows OS: windows
GIT_DEPTH: 5 GIT_DEPTH: 5
before_script: before_script:
- ./build/install_choco.ps1 - ./docker/install_choco.ps1
- choco install -y --x86 python3 7zip checksum - choco install -y --x86 python3 7zip checksum
# - python --version | findstr /B "Python 3\.7\." # dont upgrade python on every run. just make sure we're on the right Python # - python --version | findstr /B "Python 3\.7\." # dont upgrade python on every run. just make sure we're on the right Python
# - pip --version | findstr /E '\(python 3\.7\)' # - pip --version | findstr /E '\(python 3\.7\)'
@ -127,15 +125,13 @@ build:windows:
- rmdir -Recurse venv - rmdir -Recurse venv
script: script:
- pip install pyinstaller - pip install pyinstaller
- pip install -e torba\. - pip install -e torba/.
- cd lbry - python docker/set_build.py
- python scripts\set_build.py - pip install -e lbry/.
- pip install -e . - pyinstaller --additional-hooks-dir=lbry/scripts/. --icon=lbry/icons/lbry256.ico -F -n lbrynet lbry/lbry/extras/cli.py
- pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico -F -n lbrynet lbry/extras/cli.py - 7z a -tzip $env:CI_PROJECT_DIR/lbrynet-${OS}.zip dist/lbrynet.exe
- cd dist
- 7z a -tzip $env:CI_PROJECT_DIR/lbrynet-${OS}.zip lbrynet.exe
- checksum --type=sha256 --file=$env:CI_PROJECT_DIR/lbrynet-${OS}.zip - checksum --type=sha256 --file=$env:CI_PROJECT_DIR/lbrynet-${OS}.zip
- ./lbrynet.exe --version - dist/lbrynet.exe --version
# upload could be done by making it a yaml alias and putting it right into the build step. that way if one OS fails, the others still get uploaded # upload could be done by making it a yaml alias and putting it right into the build step. that way if one OS fails, the others still get uploaded

View file

@ -55,17 +55,15 @@ jobs:
env: OS=linux env: OS=linux
install: install:
- pip install pyinstaller awscli - pip install pyinstaller awscli
- cd torba && pip install -e . && cd .. - python docker/set_build.py
- cd lbry - pip install -e torba/.
- python scripts/set_build.py - pip install -e lbry/.
- pip install -e .
script: script:
- pyinstaller -F -n lbrynet lbry/extras/cli.py - pyinstaller -F -n lbrynet lbry/lbry/extras/cli.py
- cd dist - chmod +x dist/lbrynet
- chmod +x lbrynet - zip --junk-paths lbrynet-${OS}.zip dist/lbrynet
- zip -j lbrynet-${OS}.zip lbrynet
- shasum -a 256 -b lbrynet-${OS}.zip - shasum -a 256 -b lbrynet-${OS}.zip
- ./lbrynet --version - dist/lbrynet --version
after_success: after_success:
- aws configure set aws_access_key_id $ARTIFACTS_KEY - aws configure set aws_access_key_id $ARTIFACTS_KEY
- aws configure set aws_secret_access_key $ARTIFACTS_SECRET - aws configure set aws_secret_access_key $ARTIFACTS_SECRET
@ -110,7 +108,7 @@ jobs:
- python -m pip install --upgrade pip - python -m pip install --upgrade pip
- pip install pywin32 - pip install pywin32
script: script:
- pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico -F -n lbrynet lbry/extras/cli.py - pyinstaller --additional-hooks-dir=lbry/scripts/. --icon=lbry/icons/lbry256.ico -F -n lbrynet lbry/lbry/extras/cli.py
- cd dist - cd dist
- 7z a -tzip lbrynet-windows.zip lbrynet.exe - 7z a -tzip lbrynet-windows.zip lbrynet.exe
- sha256sum -b lbrynet-windows.zip - sha256sum -b lbrynet-windows.zip
@ -122,7 +120,7 @@ jobs:
script: script:
- set -e - set -e
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin - echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- travis_retry docker build -t lbry/wallet-server:$TRAVIS_TAG -t lbry/wallet-server:latest-release -f lbry/scripts/Dockerfile.wallet_server . - travis_retry docker build -t lbry/wallet-server:$TRAVIS_TAG -t lbry/wallet-server:latest-release -f docker/Dockerfile.wallet_server .
- docker push lbry/wallet-server:$TRAVIS_TAG - docker push lbry/wallet-server:$TRAVIS_TAG
- docker push lbry/wallet-server:latest-release - docker push lbry/wallet-server:latest-release
@ -132,7 +130,7 @@ jobs:
script: script:
- set -e - set -e
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin - echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- travis_retry docker build -t lbry/wallet-server:master -f lbry/scripts/Dockerfile.wallet_server . - travis_retry docker build -t lbry/wallet-server:master -f docker/Dockerfile.wallet_server .
- docker push lbry/wallet-server:master - docker push lbry/wallet-server:master
cache: cache:

View file

@ -8,7 +8,9 @@ RUN mkdir -p /home/$user/
RUN chown -R $user:$user /home/$user/ RUN chown -R $user:$user /home/$user/
# install python, pip, git and clean up # install python, pip, git and clean up
RUN apt-get update && apt-get -y --no-install-recommends install build-essential git tar wget python3.7 python3.7-dev python3-pip && rm -rf /var/lib/apt/lists/* RUN apt-get update && \
apt-get -y --no-install-recommends install build-essential git tar wget python3.7 python3.7-dev python3-pip && \
rm -rf /var/lib/apt/lists/*
# create and chown database dir # create and chown database dir
ARG db_dir=/database ARG db_dir=/database
@ -26,8 +28,7 @@ RUN python3.7 -m pip install --upgrade pip setuptools
RUN python3.7 -m pip install --user uvloop RUN python3.7 -m pip install --user uvloop
# copy lbrynet # copy lbrynet
ARG projects_dir=/home/$user/projects ARG projects_dir=/home/$user
RUN mkdir $projects_dir
COPY . $projects_dir COPY . $projects_dir
USER root USER root
RUN chown -R $user:$user . RUN chown -R $user:$user .
@ -35,7 +36,7 @@ USER $user
# install torba & lbry # install torba & lbry
WORKDIR $projects_dir/torba WORKDIR $projects_dir/torba
RUN python3.7 -m pip install --user . RUN python3.7 -m pip install --user -e .
WORKDIR $projects_dir/lbry WORKDIR $projects_dir/lbry
RUN python3.7 -m pip install --user -e . RUN python3.7 -m pip install --user -e .
RUN rm ~/.cache -rf RUN rm ~/.cache -rf
@ -53,5 +54,5 @@ ENV BANDWIDTH_LIMIT=1000000000000000000000000000000000000000000
ENV MAX_SESSIONS=1000000000 ENV MAX_SESSIONS=1000000000
ENV MAX_SEND=1000000000000000000 ENV MAX_SEND=1000000000000000000
ENV EVENT_LOOP_POLICY=uvloop ENV EVENT_LOOP_POLICY=uvloop
COPY ./lbry/scripts/wallet_server_entrypoint.sh /entrypoint.sh COPY ./docker/wallet_server_entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View file

@ -23,10 +23,13 @@ def get_build_type(ci_tag=None):
def main(): def main():
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
build_type_path = os.path.join(root_dir, 'lbry', 'build_type.py') build_type_path = os.path.join(root_dir, 'lbry', 'lbry', 'build_type.py')
log.debug("configuring build type file: %s", build_type_path) log.debug("configuring build type file: %s", build_type_path)
commit_hash = os.getenv('CI_COMMIT_SHA', os.getenv('TRAVIS_COMMIT', None))[:6] commit_hash = os.getenv('CI_COMMIT_SHA', os.getenv('TRAVIS_COMMIT'))
build_type = get_build_type(os.getenv('CI_COMMIT_TAG', os.getenv('TRAVIS_TAG', None))) if commit_hash is None:
raise ValueError("Commit hash not found in env vars")
commit_hash = commit_hash[:6]
build_type = get_build_type(os.getenv('CI_COMMIT_TAG', os.getenv('TRAVIS_TAG')))
log.debug("setting build type=%s, build commit=%s", build_type, commit_hash) log.debug("setting build type=%s, build commit=%s", build_type, commit_hash)
with open(build_type_path, 'w') as f: with open(build_type_path, 'w') as f:
f.write(f"BUILD = \"{build_type}\"\nBUILD_COMMIT = \"{commit_hash}\"\n") f.write(f"BUILD = \"{build_type}\"\nBUILD_COMMIT = \"{commit_hash}\"\n")

1
lbry/.gitignore vendored
View file

@ -11,3 +11,4 @@ __pycache__
_trial_temp/ _trial_temp/
/tests/integration/files /tests/integration/files
/tests/.coverage.*