From 3938cf33d821f92d1c9f307e8888aaac0c8e7b9a Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Thu, 12 Dec 2019 14:03:38 -0500 Subject: [PATCH 1/4] take github actions for a spin --- .github/workflows/main.yml | 87 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..c4e8f9841 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,87 @@ +name: ci +#on: [push, pull_request] +on: push +jobs: + +# lint: +# name: "pylint & mypy" +# runs-on: ubuntu-16.04 +# steps: +# - uses: actions/checkout@v1 +# - uses: actions/setup-python@v1 +# with: +# python-version: '3.7' +# - run: make install tools +# - run: make lint +# +# tests-unit: +# needs: lint +# name: "tests / unit" +# runs-on: ubuntu-16.04 +# steps: +# - uses: actions/checkout@v1 +# - uses: actions/setup-python@v1 +# with: +# python-version: '3.7' +# - run: make install tools +# - working-directory: lbry +# env: +# HOME: /tmp +# run: coverage run -p --source=lbry -m unittest discover -vv tests.unit +# + tests-integration: + #needs: lint + name: "tests / integration" + runs-on: ubuntu-16.04 + strategy: + matrix: + test: + - datanetwork + - blockchain + - other + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.7' + - if: matrix.test == 'blockchain' + run: sudo apt install -y --no-install-recommends ffmpeg + - run: pip install tox-travis + - run: tox -e ${{ matrix.test }} + + build: + #needs: ["tests-unit", "tests-integration"] + needs: ["tests-integration"] + 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: Setup + run: | + pip install pyinstaller + pip install -e . + - if: startsWith(matrix.os, 'windows') == false + name: Build & Run (Unix) + run: | + pyinstaller --onefile --name lbrynet lbry/extras/cli.py + chmod +x dist/lbrynet + dist/lbrynet --version + - if: startsWith(matrix.os, 'windows') + name: Build & Run (Windows) + run: | + pip install pywin32 + pyinstaller --additional-hooks-dir=scripts/. \ + --icon=icons/lbry256.ico \ + --onefile \ + --name lbrynet \ + lbry/extras/cli.py + dist/lbrynet.exe --version From 3fbc012231054d185501e58f9ec616f9ea3f6c79 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sun, 9 Feb 2020 14:50:09 -0500 Subject: [PATCH 2/4] moved blockchain/test_transcoding.py -> other/test_transcoding.py --- tests/integration/{blockchain => other}/test_transcoding.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/{blockchain => other}/test_transcoding.py (100%) diff --git a/tests/integration/blockchain/test_transcoding.py b/tests/integration/other/test_transcoding.py similarity index 100% rename from tests/integration/blockchain/test_transcoding.py rename to tests/integration/other/test_transcoding.py From 9a49eb06da37fc86bb6e322fc0e2ccbb4af54ab1 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sun, 9 Feb 2020 14:52:40 -0500 Subject: [PATCH 3/4] fix import path in test_transcoding.py --- .github/workflows/main.yml | 72 ++++++++++----------- .gitlab-ci.yml | 4 +- tests/integration/other/test_transcoding.py | 2 +- 3 files changed, 36 insertions(+), 42 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c4e8f9841..b71b7dabd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,38 +1,37 @@ name: ci -#on: [push, pull_request] -on: push +on: pull_request jobs: -# lint: -# name: "pylint & mypy" -# runs-on: ubuntu-16.04 -# steps: -# - uses: actions/checkout@v1 -# - uses: actions/setup-python@v1 -# with: -# python-version: '3.7' -# - run: make install tools -# - run: make lint -# -# tests-unit: -# needs: lint -# name: "tests / unit" -# runs-on: ubuntu-16.04 -# steps: -# - uses: actions/checkout@v1 -# - uses: actions/setup-python@v1 -# with: -# python-version: '3.7' -# - run: make install tools -# - working-directory: lbry -# env: -# HOME: /tmp -# run: coverage run -p --source=lbry -m unittest discover -vv tests.unit -# + lint: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.7' + - run: make install tools + - run: make lint + + tests-unit: + needs: lint + name: "tests / unit" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.7' + - run: make install tools + - working-directory: lbry + env: + HOME: /tmp + run: coverage run -p --source=lbry -m unittest discover -vv tests.unit + tests-integration: - #needs: lint + needs: lint name: "tests / integration" - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest strategy: matrix: test: @@ -44,19 +43,18 @@ jobs: - uses: actions/setup-python@v1 with: python-version: '3.7' - - if: matrix.test == 'blockchain' + - if: matrix.test == 'other' run: sudo apt install -y --no-install-recommends ffmpeg - run: pip install tox-travis - run: tox -e ${{ matrix.test }} build: - #needs: ["tests-unit", "tests-integration"] - needs: ["tests-integration"] + needs: ["tests-unit", "tests-integration"] name: "build" strategy: matrix: os: - - ubuntu-16.04 + - ubuntu-latest - macos-latest - windows-latest runs-on: ${{ matrix.os }} @@ -79,9 +77,5 @@ jobs: name: Build & Run (Windows) run: | pip install pywin32 - pyinstaller --additional-hooks-dir=scripts/. \ - --icon=icons/lbry256.ico \ - --onefile \ - --name lbrynet \ - lbry/extras/cli.py + pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico --onefile --name lbrynet lbry/extras/cli.py dist/lbrynet.exe --version diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f9d2be2c..02652a791 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,14 +46,14 @@ test:datanetwork-integration: test:blockchain-integration: stage: test script: - - apt-get update - - apt-get install -y --no-install-recommends ffmpeg - pip install tox-travis - tox -e blockchain test:other-integration: stage: test script: + - apt-get update + - apt-get install -y --no-install-recommends ffmpeg - pip install tox-travis - tox -e other diff --git a/tests/integration/other/test_transcoding.py b/tests/integration/other/test_transcoding.py index 47fe511c7..c832ec4ec 100644 --- a/tests/integration/other/test_transcoding.py +++ b/tests/integration/other/test_transcoding.py @@ -2,7 +2,7 @@ import logging import pathlib import time -from .test_claim_commands import ClaimTestCase +from ..blockchain.test_claim_commands import ClaimTestCase from lbry.conf import TranscodeConfig from lbry.file_analysis import VideoFileAnalyzer From 0185cb48fba614292ba226b0e38fd8323e55c375 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sun, 9 Feb 2020 16:34:04 -0500 Subject: [PATCH 4/4] run lint and tests in parallel --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b71b7dabd..fab46fcf4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,6 @@ jobs: - run: make lint tests-unit: - needs: lint name: "tests / unit" runs-on: ubuntu-latest steps: @@ -29,7 +28,6 @@ jobs: run: coverage run -p --source=lbry -m unittest discover -vv tests.unit tests-integration: - needs: lint name: "tests / integration" runs-on: ubuntu-latest strategy: @@ -49,7 +47,7 @@ jobs: - run: tox -e ${{ matrix.test }} build: - needs: ["tests-unit", "tests-integration"] + needs: ["lint", "tests-unit", "tests-integration"] name: "build" strategy: matrix: