2019-08-20 15:11:52 -04:00
|
|
|
default:
|
|
|
|
image: python:3.7
|
|
|
|
|
|
|
|
|
|
|
|
#cache:
|
|
|
|
# directories:
|
|
|
|
# - $HOME/venv
|
|
|
|
# - $HOME/.cache/pip
|
|
|
|
# - $HOME/Library/Caches/pip
|
|
|
|
# - $HOME/Library/Caches/Homebrew
|
|
|
|
# - $TRAVIS_BUILD_DIR/.tox
|
|
|
|
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
2019-12-16 14:02:17 -05:00
|
|
|
- assets
|
2019-08-20 15:11:52 -04:00
|
|
|
- release
|
|
|
|
|
|
|
|
|
2019-12-16 14:02:17 -05:00
|
|
|
.tagged:
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^v[0-9\.]+$/'
|
|
|
|
when: on_success
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-20 15:11:52 -04:00
|
|
|
test:lint:
|
|
|
|
stage: test
|
|
|
|
script:
|
2019-12-07 23:38:54 -05:00
|
|
|
- make install tools
|
2019-12-31 15:01:14 -05:00
|
|
|
#- make lint
|
2019-08-20 15:11:52 -04:00
|
|
|
|
2019-12-31 14:52:57 -05:00
|
|
|
test:unit:
|
2019-08-20 15:11:52 -04:00
|
|
|
stage: test
|
|
|
|
script:
|
2019-12-07 23:38:54 -05:00
|
|
|
- make install tools
|
2019-08-20 15:11:52 -04:00
|
|
|
- cd lbry && HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit
|
|
|
|
|
2019-12-31 14:52:57 -05:00
|
|
|
test:integration:
|
2019-08-20 15:11:52 -04:00
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- pip install coverage tox-travis
|
|
|
|
- cd lbry && tox
|
|
|
|
|
|
|
|
test:json-api:
|
|
|
|
stage: test
|
|
|
|
script:
|
2019-12-07 23:38:54 -05:00
|
|
|
- make install tools
|
2019-08-20 15:11:52 -04:00
|
|
|
- cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.build:
|
|
|
|
stage: build
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 day
|
|
|
|
paths:
|
|
|
|
- lbrynet-${OS}.zip
|
|
|
|
script:
|
|
|
|
- pip install pyinstaller
|
2019-11-21 14:16:10 -05:00
|
|
|
- python3.7 docker/set_build.py
|
|
|
|
- pip install -e lbry/.
|
|
|
|
- pyinstaller --onefile --name lbrynet lbry/lbry/extras/cli.py
|
|
|
|
- chmod +x dist/lbrynet
|
|
|
|
- zip --junk-paths ${CI_PROJECT_DIR}/lbrynet-${OS}.zip dist/lbrynet # gitlab expects artifacts to be in $CI_PROJECT_DIR
|
2019-08-20 15:11:52 -04:00
|
|
|
- openssl dgst -sha256 ${CI_PROJECT_DIR}/lbrynet-${OS}.zip | egrep -o [0-9a-f]+$ # get sha256 of asset. works on mac and ubuntu
|
2019-11-21 14:16:10 -05:00
|
|
|
- dist/lbrynet --version
|
2019-08-20 15:11:52 -04:00
|
|
|
|
|
|
|
build:linux:
|
|
|
|
extends: .build
|
|
|
|
image: ubuntu:18.04 # cant use python3.7 image - binary won't run on ubuntu
|
|
|
|
variables:
|
|
|
|
OS: linux
|
|
|
|
before_script:
|
|
|
|
- apt-get update
|
|
|
|
- apt-get install -y --no-install-recommends software-properties-common zip curl build-essential
|
|
|
|
- add-apt-repository -y ppa:deadsnakes/ppa
|
|
|
|
- apt-get install -y --no-install-recommends python3.7-dev python3-setuptools python3-wheel
|
|
|
|
- python3.7 <(curl -q https://bootstrap.pypa.io/get-pip.py) # make sure we get pip with python3.7
|
|
|
|
|
|
|
|
build:mac:
|
|
|
|
extends: .build
|
|
|
|
tags: [macos] # makes gitlab use the mac runner
|
|
|
|
variables:
|
|
|
|
OS: mac
|
|
|
|
GIT_DEPTH: 5
|
|
|
|
VENV: /tmp/gitlab-lbry-sdk-venv
|
|
|
|
before_script:
|
|
|
|
# - brew upgrade python || true
|
|
|
|
- python3 --version | grep -q '^Python 3\.7\.' # dont upgrade python on every run. just make sure we're on the right Python
|
|
|
|
# - pip3 install --user --upgrade pip virtualenv
|
|
|
|
- pip3 --version | grep -q '\(python 3\.7\)'
|
|
|
|
- virtualenv --python=python3.7 "${VENV}"
|
|
|
|
- source "${VENV}/bin/activate"
|
|
|
|
after_script:
|
|
|
|
- rm -rf "${VENV}"
|
|
|
|
|
2019-09-09 13:47:20 -04:00
|
|
|
build:windows:
|
|
|
|
extends: .build
|
|
|
|
tags: [windows] # makes gitlab use the windows runner
|
|
|
|
variables:
|
|
|
|
OS: windows
|
|
|
|
GIT_DEPTH: 5
|
|
|
|
before_script:
|
2019-11-21 14:16:10 -05:00
|
|
|
- ./docker/install_choco.ps1
|
2019-09-09 13:47:20 -04:00
|
|
|
- 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
|
|
|
|
# - pip --version | findstr /E '\(python 3\.7\)'
|
|
|
|
- pip install virtualenv pywin32
|
|
|
|
- virtualenv venv
|
|
|
|
- venv/Scripts/activate.ps1
|
|
|
|
after_script:
|
|
|
|
- rmdir -Recurse venv
|
|
|
|
script:
|
|
|
|
- pip install pyinstaller
|
2019-11-21 14:16:10 -05:00
|
|
|
- python docker/set_build.py
|
|
|
|
- pip install -e lbry/.
|
|
|
|
- pyinstaller --additional-hooks-dir=lbry/scripts/. --icon=lbry/icons/lbry256.ico -F -n lbrynet lbry/lbry/extras/cli.py
|
2019-12-16 20:32:42 -05:00
|
|
|
- 7z a -tzip $env:CI_PROJECT_DIR/lbrynet-${OS}.zip ./dist/lbrynet.exe
|
2019-09-09 13:47:20 -04:00
|
|
|
- checksum --type=sha256 --file=$env:CI_PROJECT_DIR/lbrynet-${OS}.zip
|
2019-11-21 14:16:10 -05:00
|
|
|
- dist/lbrynet.exe --version
|
2019-08-20 15:11:52 -04:00
|
|
|
|
|
|
|
|
2019-12-16 14:02:17 -05:00
|
|
|
|
2019-12-13 12:00:45 -05:00
|
|
|
# s3 = upload asset to s3 (build.lbry.io)
|
|
|
|
.s3:
|
2019-12-16 14:02:17 -05:00
|
|
|
stage: assets
|
2019-08-20 15:11:52 -04:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
script:
|
2019-12-20 12:21:41 -05:00
|
|
|
- "[ -f lbrynet-${OS}.zip ]" # check that asset exists before trying to upload
|
2019-08-20 15:11:52 -04:00
|
|
|
- pip install awscli
|
|
|
|
- S3_PATH="daemon/gitlab-build-${CI_PIPELINE_ID}_commit-${CI_COMMIT_SHA:0:7}$( if [ ! -z ${CI_COMMIT_TAG} ]; then echo _tag-${CI_COMMIT_TAG}; else echo _branch-${CI_COMMIT_REF_NAME}; fi )"
|
|
|
|
- AWS_ACCESS_KEY_ID=${ARTIFACTS_KEY} AWS_SECRET_ACCESS_KEY=${ARTIFACTS_SECRET} AWS_REGION=${ARTIFACTS_REGION}
|
|
|
|
aws s3 cp lbrynet-${OS}.zip s3://${ARTIFACTS_BUCKET}/${S3_PATH}/lbrynet-${OS}.zip
|
|
|
|
|
|
|
|
s3:linux:
|
2019-12-13 12:00:45 -05:00
|
|
|
extends: .s3
|
|
|
|
variables: {OS: linux}
|
2019-12-16 14:02:17 -05:00
|
|
|
needs: ["build:linux"]
|
2019-08-20 15:11:52 -04:00
|
|
|
|
|
|
|
s3:mac:
|
2019-12-13 12:00:45 -05:00
|
|
|
extends: .s3
|
|
|
|
variables: {OS: mac}
|
2019-12-16 14:02:17 -05:00
|
|
|
needs: ["build:mac"]
|
2019-08-20 15:11:52 -04:00
|
|
|
|
2019-09-09 13:47:20 -04:00
|
|
|
s3:windows:
|
2019-12-13 12:00:45 -05:00
|
|
|
extends: .s3
|
|
|
|
variables: {OS: windows}
|
2019-12-16 14:02:17 -05:00
|
|
|
needs: ["build:windows"]
|
2019-12-13 12:00:45 -05:00
|
|
|
|
2019-12-16 14:02:17 -05:00
|
|
|
|
|
|
|
|
|
|
|
# github = upload assets to github when there's a tagged release
|
|
|
|
.github:
|
|
|
|
extends: .tagged
|
|
|
|
stage: assets
|
2019-09-09 13:47:20 -04:00
|
|
|
variables:
|
2019-12-13 12:00:45 -05:00
|
|
|
GIT_STRATEGY: none
|
|
|
|
script:
|
2019-12-20 12:21:41 -05:00
|
|
|
- "[ -f lbrynet-${OS}.zip ]" # check that asset exists before trying to upload. githubrelease won't error if its missing
|
2019-12-13 12:00:45 -05:00
|
|
|
- pip install githubrelease
|
|
|
|
- githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} asset lbryio/lbry-sdk upload ${CI_COMMIT_TAG} lbrynet-${OS}.zip
|
|
|
|
|
2019-12-16 14:02:17 -05:00
|
|
|
github:linux:
|
|
|
|
extends: .github
|
2019-12-13 12:00:45 -05:00
|
|
|
variables: {OS: linux}
|
2019-12-16 14:02:17 -05:00
|
|
|
needs: ["build:linux"]
|
2019-12-13 12:00:45 -05:00
|
|
|
|
2019-12-16 14:02:17 -05:00
|
|
|
github:mac:
|
|
|
|
extends: .github
|
2019-12-13 12:00:45 -05:00
|
|
|
variables: {OS: mac}
|
2019-12-16 14:02:17 -05:00
|
|
|
needs: ["build:mac"]
|
2019-12-13 12:00:45 -05:00
|
|
|
|
2019-12-16 14:02:17 -05:00
|
|
|
github:windows:
|
|
|
|
extends: .github
|
2019-12-13 12:00:45 -05:00
|
|
|
variables: {OS: windows}
|
2019-12-16 14:02:17 -05:00
|
|
|
needs: ["build:windows"]
|
|
|
|
|
|
|
|
|
2019-08-20 15:11:52 -04:00
|
|
|
|
2019-12-16 14:02:17 -05:00
|
|
|
publish:
|
|
|
|
extends: .tagged
|
|
|
|
stage: release
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
script:
|
|
|
|
- pip install githubrelease
|
|
|
|
- githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} release lbryio/lbry-sdk publish ${CI_COMMIT_TAG}
|
|
|
|
- >
|
2019-12-20 10:26:41 -05:00
|
|
|
curl -X POST -H 'Content-type: application/json' --data '{"text":"<!channel> There is a new SDK release: https://github.com/lbryio/lbry-sdk/releases/tag/'"${CI_COMMIT_TAG}"'\n'"$(curl -s "https://api.github.com/repos/lbryio/lbry-sdk/releases/tags/${CI_COMMIT_TAG}" | egrep '\w*\"body\":' | cut -d':' -f 2- | tail -c +3 | head -c -2)"'", "channel":"tech"}' "$(echo ${SLACK_WEBHOOK_URL_BASE64} | base64 -d)"
|