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

145 lines
4.2 KiB
YAML
Raw Normal View History

2019-12-12 14:03:38 -05:00
name: ci
2020-06-03 19:45:10 -04:00
on: push
2019-12-12 14:03:38 -05:00
jobs:
2020-06-05 00:35:22 -04:00
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- 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
pip install -e .[lint]
- run: make lint
tests-unit:
name: "tests / unit"
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- 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
pip install -e .[test]
2020-06-06 12:20:19 -04:00
- env:
2020-06-05 00:35:22 -04:00
HOME: /tmp
2020-06-06 12:20:19 -04:00
run: coverage run -m unittest -vv tests.unit.test_conf
# run: coverage run -m unittest discover -vv tests.unit
2020-06-06 12:23:32 -04:00
- uses: codecov/codecov-action@v1
with:
flags: unit-${{ matrix.os }}
2020-06-05 00:35:22 -04:00
tests-integration:
name: "tests / integration"
runs-on: ubuntu-latest
strategy:
matrix:
test:
2020-06-03 19:43:08 -04:00
# - datanetwork
2020-06-05 00:35:22 -04:00
- blockchain
2020-06-03 19:43:08 -04:00
# - other
2020-06-05 00:35:22 -04:00
db:
- sqlite
2020-06-03 19:43:08 -04:00
# - postgres
# services:
# postgres:
# image: postgres:12
# env:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: postgres
# ports:
# - 5432:5432
# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
2020-06-05 00:35:22 -04:00
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- if: matrix.test == 'other'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ffmpeg
- run: pip install tox-travis
- env:
TEST_DB: ${{ matrix.db }}
run: tox -e ${{ matrix.test }}
2020-06-03 19:45:10 -04:00
build:
2020-06-05 00:35:22 -04:00
needs: ["lint", "tests-unit", "tests-integration"]
2020-06-03 19:45:10 -04:00
name: "build"
strategy:
matrix:
os:
- ubuntu-16.04
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- 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-
- if: startsWith(runner.os, 'linux')
run: sudo apt-get install libzmq3-dev
- if: startsWith(runner.os, 'mac')
run: brew install zeromq
- name: Setup
run: |
pip install --user --upgrade pip wheel
pip install sqlalchemy@git+https://github.com/eukreign/pyinstaller.git@sqlalchemy
pip install -e .
2020-06-04 18:17:37 -04:00
- if: startsWith(runner.os, 'linux')
run: pip install psycopg2
2020-06-03 19:45:10 -04:00
- if: startsWith(runner.os, 'linux') || startsWith(runner.os, 'mac')
name: Build & Run (Unix)
run: |
pyinstaller --onefile --name lbrynet lbry/cli.py
chmod +x dist/lbrynet
dist/lbrynet --version
- if: startsWith(runner.os, 'windows')
name: Build & Run (Windows)
run: |
pip install pywin32
pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico --onefile --name lbrynet lbry/cli.py
dist/lbrynet.exe --version
- uses: actions/upload-artifact@v2
with:
name: lbrynet-${{ matrix.os }}
2020-06-03 19:45:10 -04:00
path: dist/