2019-12-12 14:03:38 -05:00
|
|
|
name: ci
|
2021-06-15 09:59:28 -04:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
|
2019-12-12 14:03:38 -05:00
|
|
|
jobs:
|
|
|
|
|
2020-02-09 14:52:40 -05:00
|
|
|
lint:
|
|
|
|
name: lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-04-13 09:57:59 -04:00
|
|
|
- uses: actions/checkout@v2
|
2020-02-09 14:52:40 -05:00
|
|
|
- uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: '3.7'
|
2021-06-15 09:59:28 -04:00
|
|
|
- name: extract pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
|
|
|
|
restore-keys: ${{ runner.os }}-pip-
|
|
|
|
- run: pip install --user --upgrade pip wheel
|
|
|
|
- run: pip install -e .[torrent,lint]
|
2020-02-09 14:52:40 -05:00
|
|
|
- run: make lint
|
|
|
|
|
|
|
|
tests-unit:
|
|
|
|
name: "tests / unit"
|
2021-06-15 09:59:28 -04:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
2021-07-30 10:21:52 -04:00
|
|
|
- macos-latest
|
|
|
|
- windows-latest
|
2021-06-15 09:59:28 -04:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-02-09 14:52:40 -05:00
|
|
|
steps:
|
2020-04-13 10:14:52 -04:00
|
|
|
- uses: actions/checkout@v2
|
2020-02-09 14:52:40 -05:00
|
|
|
- uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: '3.7'
|
2021-06-15 09:59:28 -04:00
|
|
|
- name: set pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: extract pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
|
|
|
|
restore-keys: ${{ runner.os }}-pip-
|
|
|
|
- run: pip install --user --upgrade pip wheel
|
2021-07-30 10:21:52 -04:00
|
|
|
- if: startsWith(runner.os, 'linux')
|
|
|
|
run: pip install -e .[torrent,test]
|
|
|
|
- if: startsWith(runner.os, 'linux')
|
|
|
|
env:
|
2020-02-09 14:52:40 -05:00
|
|
|
HOME: /tmp
|
2021-04-20 15:41:09 -04:00
|
|
|
run: make test-unit-coverage
|
2021-07-30 10:43:24 -04:00
|
|
|
- if: startsWith(runner.os, 'linux') != true
|
2021-07-30 10:21:52 -04:00
|
|
|
run: pip install -e .[test]
|
2021-07-30 10:43:24 -04:00
|
|
|
- if: startsWith(runner.os, 'linux') != true
|
2021-07-30 10:21:52 -04:00
|
|
|
env:
|
|
|
|
HOME: /tmp
|
|
|
|
run: python -m unittest tests/unit/test_conf.py
|
2021-08-21 09:15:20 -04:00
|
|
|
- name: submit coverage report
|
|
|
|
uses: coverallsapp/github-action@master
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.github_token }}
|
|
|
|
flag-name: tests-unit-${{ matrix.os }}
|
|
|
|
parallel: true
|
2020-02-09 14:52:40 -05:00
|
|
|
|
2019-12-12 14:03:38 -05:00
|
|
|
tests-integration:
|
|
|
|
name: "tests / integration"
|
2020-02-09 14:52:40 -05:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-12 14:03:38 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
test:
|
|
|
|
- datanetwork
|
|
|
|
- blockchain
|
|
|
|
- other
|
|
|
|
steps:
|
2021-01-20 01:57:15 -03:00
|
|
|
- name: Configure sysctl limits
|
|
|
|
run: |
|
2021-06-15 09:59:28 -04:00
|
|
|
sudo swapoff -a
|
|
|
|
sudo sysctl -w vm.swappiness=1
|
|
|
|
sudo sysctl -w fs.file-max=262144
|
|
|
|
sudo sysctl -w vm.max_map_count=262144
|
2021-01-20 01:57:15 -03:00
|
|
|
- name: Runs Elasticsearch
|
|
|
|
uses: elastic/elastic-github-actions/elasticsearch@master
|
|
|
|
with:
|
2021-06-15 09:59:28 -04:00
|
|
|
stack-version: 7.6.0
|
2020-04-13 10:14:52 -04:00
|
|
|
- uses: actions/checkout@v2
|
2019-12-12 14:03:38 -05:00
|
|
|
- uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: '3.7'
|
2020-02-09 14:52:40 -05:00
|
|
|
- if: matrix.test == 'other'
|
2020-04-13 10:14:52 -04:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y --no-install-recommends ffmpeg
|
2021-06-15 09:59:28 -04:00
|
|
|
- name: extract pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ./.tox
|
|
|
|
key: tox-integration-${{ matrix.test }}-${{ hashFiles('setup.py') }}
|
|
|
|
restore-keys: txo-integration-${{ matrix.test }}-
|
|
|
|
- run: pip install tox
|
2019-12-12 14:03:38 -05:00
|
|
|
- run: tox -e ${{ matrix.test }}
|
|
|
|
|
2021-08-21 09:04:44 -04:00
|
|
|
coverage:
|
|
|
|
needs: ["tests-unit", "tests-integration"]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-21 09:15:20 -04:00
|
|
|
- name: Coveralls Finished
|
|
|
|
uses: coverallsapp/github-action@master
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.github_token }}
|
|
|
|
parallel-finished: true
|
2021-08-21 09:04:44 -04:00
|
|
|
|
2019-12-12 14:03:38 -05:00
|
|
|
build:
|
2020-02-09 16:34:04 -05:00
|
|
|
needs: ["lint", "tests-unit", "tests-integration"]
|
2021-06-15 09:59:28 -04:00
|
|
|
name: "build / binary"
|
2019-12-12 14:03:38 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
2021-06-15 09:59:28 -04:00
|
|
|
- ubuntu-16.04
|
2019-12-12 14:03:38 -05:00
|
|
|
- macos-latest
|
|
|
|
- windows-latest
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
2020-04-13 10:14:52 -04:00
|
|
|
- uses: actions/checkout@v2
|
2019-12-12 14:03:38 -05:00
|
|
|
- uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: '3.7'
|
2021-06-15 09:59:28 -04:00
|
|
|
- id: os-name
|
|
|
|
uses: ASzc/change-string-case-action@v1
|
|
|
|
with:
|
|
|
|
string: ${{ runner.os }}
|
|
|
|
- name: set pip cache dir
|
|
|
|
id: pip-cache
|
|
|
|
run: echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: extract pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
|
|
|
|
restore-keys: ${{ runner.os }}-pip-
|
|
|
|
- run: pip install pyinstaller==4.4
|
|
|
|
- run: pip install -e .
|
|
|
|
- if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
run: python docker/set_build.py
|
|
|
|
- if: startsWith(runner.os, 'linux') || startsWith(runner.os, 'mac')
|
2019-12-12 14:03:38 -05:00
|
|
|
name: Build & Run (Unix)
|
|
|
|
run: |
|
|
|
|
pyinstaller --onefile --name lbrynet lbry/extras/cli.py
|
|
|
|
dist/lbrynet --version
|
2021-06-15 09:59:28 -04:00
|
|
|
- if: startsWith(runner.os, 'windows')
|
2019-12-12 14:03:38 -05:00
|
|
|
name: Build & Run (Windows)
|
|
|
|
run: |
|
2021-06-15 09:59:28 -04:00
|
|
|
pip install pywin32==301
|
2020-02-09 14:52:40 -05:00
|
|
|
pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico --onefile --name lbrynet lbry/extras/cli.py
|
2019-12-12 14:03:38 -05:00
|
|
|
dist/lbrynet.exe --version
|
2021-06-15 09:59:28 -04:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: lbrynet-${{ steps.os-name.outputs.lowercase }}
|
|
|
|
path: dist/
|
|
|
|
|
|
|
|
release:
|
|
|
|
name: "release"
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
needs: ["build"]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-07-21 11:33:41 -04:00
|
|
|
- uses: actions/checkout@v1
|
2021-06-15 09:59:28 -04:00
|
|
|
- uses: actions/download-artifact@v2
|
2021-07-23 15:23:38 -04:00
|
|
|
- name: upload binaries
|
|
|
|
env:
|
2021-07-26 23:30:00 -04:00
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_API_TOKEN }}
|
2021-06-15 09:59:28 -04:00
|
|
|
run: |
|
2021-07-23 15:23:38 -04:00
|
|
|
pip install githubrelease
|
2021-06-15 09:59:28 -04:00
|
|
|
chmod +x lbrynet-macos/lbrynet
|
|
|
|
chmod +x lbrynet-linux/lbrynet
|
|
|
|
zip --junk-paths lbrynet-mac.zip lbrynet-macos/lbrynet
|
|
|
|
zip --junk-paths lbrynet-linux.zip lbrynet-linux/lbrynet
|
|
|
|
zip --junk-paths lbrynet-windows.zip lbrynet-windows/lbrynet.exe
|
|
|
|
ls -lh
|
2021-07-26 16:58:11 -04:00
|
|
|
githubrelease release lbryio/lbry-sdk info ${GITHUB_REF#refs/tags/}
|
2021-07-26 23:30:00 -04:00
|
|
|
githubrelease asset lbryio/lbry-sdk upload ${GITHUB_REF#refs/tags/} \
|
2021-07-23 15:23:38 -04:00
|
|
|
lbrynet-mac.zip lbrynet-linux.zip lbrynet-windows.zip
|
2021-07-26 23:30:00 -04:00
|
|
|
githubrelease release lbryio/lbry-sdk publish ${GITHUB_REF#refs/tags/}
|
|
|
|
|