Fix checking protocol version #3460
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: ["push", "pull_request", "workflow_dispatch"] | |
jobs: | |
lint: | |
name: lint | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: extract pip cache | |
uses: actions/cache@v4 | |
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 .[lint] | |
- run: make lint | |
tests-unit: | |
name: "tests / unit" | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-13 | |
- windows-2022 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: set pip cache dir | |
shell: bash | |
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_ENV | |
- name: extract pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.PIP_CACHE_DIR }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: ${{ runner.os }}-pip- | |
- id: os-name | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ runner.os }} | |
- run: python -m pip install --user --upgrade pip wheel | |
- if: startsWith(runner.os, 'linux') | |
run: pip install -e .[test] | |
- if: startsWith(runner.os, 'linux') | |
env: | |
HOME: /tmp | |
run: make test-unit-coverage | |
- if: startsWith(runner.os, 'linux') != true | |
run: pip install -e .[test] | |
- if: startsWith(runner.os, 'linux') != true | |
env: | |
HOME: /tmp | |
run: coverage run --source=lbry -m unittest tests/unit/test_conf.py | |
- name: submit coverage report | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: tests-unit-${{ steps.os-name.outputs.lowercase }} | |
COVERALLS_PARALLEL: true | |
run: | | |
pip install coveralls | |
coveralls --service=github | |
tests-integration: | |
name: "tests / integration" | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
test: | |
- datanetwork | |
- blockchain | |
- claims | |
- takeovers | |
- transactions | |
- other | |
steps: | |
- 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 | |
- name: Runs Elasticsearch | |
uses: elastic/elastic-github-actions/elasticsearch@master | |
with: | |
stack-version: 7.12.1 | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- if: matrix.test == 'other' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends ffmpeg | |
- name: extract pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ./.tox | |
key: tox-integration-${{ matrix.test }}-${{ hashFiles('setup.py') }} | |
restore-keys: txo-integration-${{ matrix.test }}- | |
- run: pip install tox coverage coveralls | |
- if: matrix.test == 'claims' | |
run: rm -rf .tox | |
- run: tox -e ${{ matrix.test }} | |
- name: submit coverage report | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: tests-integration-${{ matrix.test }} | |
COVERALLS_PARALLEL: true | |
run: | | |
coverage combine tests | |
coveralls --service=github | |
coverage: | |
needs: ["tests-unit", "tests-integration"] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: finalize coverage report submission | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
pip install coveralls | |
coveralls --service=github --finish | |
build: | |
needs: ["lint", "tests-unit", "tests-integration"] | |
name: "build / binary" | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-13 | |
- windows-2022 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- id: os-name | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ runner.os }} | |
- name: set pip cache dir | |
shell: bash | |
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_ENV | |
- name: extract pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.PIP_CACHE_DIR }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: ${{ runner.os }}-pip- | |
- run: pip install pyinstaller==6.0 | |
- 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') | |
name: Build & Run (Unix) | |
run: | | |
pyinstaller --onefile --name lbrynet lbry/extras/cli.py | |
dist/lbrynet --version | |
- if: startsWith(runner.os, 'windows') | |
name: Build & Run (Windows) | |
run: | | |
pip install pywin32==301 | |
pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico --onefile --name lbrynet lbry/extras/cli.py | |
dist/lbrynet.exe --version | |
- uses: actions/upload-artifact@v4 | |
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: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: upload binaries | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_API_TOKEN }} | |
run: | | |
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 | |
githubrelease release lbryio/lbry-sdk info ${GITHUB_REF#refs/tags/} | |
githubrelease asset lbryio/lbry-sdk upload ${GITHUB_REF#refs/tags/} \ | |
lbrynet-mac.zip lbrynet-linux.zip lbrynet-windows.zip | |
githubrelease release lbryio/lbry-sdk publish ${GITHUB_REF#refs/tags/} | |