lbry-sdk/.github/workflows/main.yml

221 lines
7.2 KiB
YAML
Raw Normal View History

2019-12-12 14:03:38 -05:00
name: ci
on: ["push", "pull_request"]
2019-12-12 14:03:38 -05:00
jobs:
2020-02-09 14:52:40 -05:00
lint:
name: lint
runs-on: ubuntu-20.04
2020-02-09 14:52:40 -05:00
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
2020-02-09 14:52:40 -05:00
with:
python-version: '3.7'
- name: extract pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-pip-
- run: pip install --user --upgrade pip wheel
2022-07-29 22:06:31 -03:00
- run: pip install -e .[lint]
2020-02-09 14:52:40 -05:00
- run: make lint
tests-unit:
name: "tests / unit"
strategy:
matrix:
os:
- ubuntu-20.04
2021-07-30 10:21:52 -04:00
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
2020-02-09 14:52:40 -05:00
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
2020-02-09 14:52:40 -05:00
with:
python-version: '3.7'
- name: set pip cache dir (linux/mac)
if: runner.os != 'Windows'
id: pip-cache
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: set pip cache dir (windows)
if: runner.os == 'Windows'
id: pip-cache
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $env:GITHUB_OUTPUT
- name: debug pip cache
run: echo "PIP_CACHE_DIR=${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}"
- name: extract pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-pip-
2021-08-21 14:44:59 -04:00
- id: os-name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ runner.os }}
2022-05-23 14:42:02 -03:00
- run: python -m pip install --user --upgrade pip wheel
2021-07-30 10:21:52 -04:00
- if: startsWith(runner.os, 'linux')
2022-07-29 22:06:31 -03:00
run: pip install -e .[test]
2021-07-30 10:21:52 -04:00
- 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
2021-08-21 10:51:37 -04:00
run: coverage run --source=lbry -m unittest tests/unit/test_conf.py
2021-08-21 09:15:20 -04:00
- name: submit coverage report
2021-08-21 09:42:18 -04:00
env:
2021-08-21 14:44:59 -04:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: tests-unit-${{ steps.os-name.outputs.lowercase }}
COVERALLS_PARALLEL: true
run: |
2021-08-21 09:42:18 -04:00
pip install coveralls
2021-09-22 18:15:13 -04:00
coveralls --service=github
2020-02-09 14:52:40 -05:00
2019-12-12 14:03:38 -05:00
tests-integration:
name: "tests / integration"
runs-on: ubuntu-20.04
2019-12-12 14:03:38 -05:00
strategy:
matrix:
test:
- datanetwork
- blockchain
- claims
- takeovers
- transactions
2019-12-12 14:03:38 -05:00
- other
steps:
2021-01-20 01:57:15 -03:00
- name: Configure sysctl limits
run: |
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-12-02 21:26:59 -05:00
stack-version: 7.12.1
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
2019-12-12 14:03:38 -05:00
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
- name: extract pip cache
uses: actions/cache@v3
with:
path: ./.tox
key: tox-integration-${{ matrix.test }}-${{ hashFiles('setup.py') }}
restore-keys: txo-integration-${{ matrix.test }}-
2021-08-21 15:41:06 -04:00
- run: pip install tox coverage coveralls
2021-12-03 17:33:27 -05:00
- if: matrix.test == 'claims'
run: rm -rf .tox
2021-09-03 03:07:15 -03:00
- run: tox -e ${{ matrix.test }}
2021-08-21 15:26:14 -04:00
- name: submit coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021-08-21 16:47:17 -04:00
COVERALLS_FLAG_NAME: tests-integration-${{ matrix.test }}
2021-08-21 15:26:14 -04:00
COVERALLS_PARALLEL: true
run: |
2021-08-21 15:41:06 -04:00
coverage combine tests
2021-09-22 18:15:13 -04:00
coveralls --service=github
2021-08-21 15:26:14 -04:00
2019-12-12 14:03:38 -05:00
2021-08-21 09:04:44 -04:00
coverage:
2021-08-21 15:31:50 -04:00
needs: ["tests-unit", "tests-integration"]
runs-on: ubuntu-20.04
2021-08-21 09:04:44 -04:00
steps:
- name: finalize coverage report submission
2021-08-21 09:42:18 -04:00
env:
2021-08-21 14:44:59 -04:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
2021-08-21 09:42:18 -04:00
pip install coveralls
2021-09-22 18:15:13 -04:00
coveralls --service=github --finish
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"]
name: "build / binary"
2019-12-12 14:03:38 -05:00
strategy:
matrix:
os:
- ubuntu-18.04
2019-12-12 14:03:38 -05:00
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
2019-12-12 14:03:38 -05:00
with:
python-version: '3.7'
- id: os-name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ runner.os }}
- name: set pip cache dir (linux/mac)
if: runner.os != 'Windows'
id: pip-cache
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: set pip cache dir (windows)
if: runner.os == 'Windows'
id: pip-cache
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $env:GITHUB_OUTPUT
- name: debug pip cache
run: echo "PIP_CACHE_DIR=${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}"
- name: extract pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-pip-
- run: pip install pyinstaller==4.6
- 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
- if: startsWith(runner.os, 'windows')
2019-12-12 14:03:38 -05:00
name: Build & Run (Windows)
run: |
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
- 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-20.04
steps:
2021-07-21 11:33:41 -04:00
- uses: actions/checkout@v1
- uses: actions/download-artifact@v2
2021-07-23 15:23:38 -04:00
- name: upload binaries
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_API_TOKEN }}
run: |
2021-07-23 15:23:38 -04:00
pip install githubrelease
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/}
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
githubrelease release lbryio/lbry-sdk publish ${GITHUB_REF#refs/tags/}