From 653a4f22a9737925f441b6af846166ed00c4c18c Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 06:52:10 +0000 Subject: [PATCH 01/12] test --- tools/docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/docs b/tools/docs index b0b6f55d..f87d4bb7 100755 --- a/tools/docs +++ b/tools/docs @@ -1,4 +1,4 @@ # Uncomment to build api docs -# sphinx-apidoc -f -o docs/source ytdl_subscribea +# sphinx-apidoc -f -o docs/source src/ytdl_sub sphinx-build -a -b html docs docs/_html From 1fe619aa41d8b49aa7efc10794e70c49235b6116 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:11:40 +0000 Subject: [PATCH 02/12] run tests and coverage in workflow --- .../workflows/{linter.yaml => build_lint_test.yaml} | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) rename .github/workflows/{linter.yaml => build_lint_test.yaml} (66%) diff --git a/.github/workflows/linter.yaml b/.github/workflows/build_lint_test.yaml similarity index 66% rename from .github/workflows/linter.yaml rename to .github/workflows/build_lint_test.yaml index 711ab9f5..caa43a9e 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -17,7 +17,17 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[lint] + pip install . - name: Run linters run: | + pip install .[lint] ./tools/linter check + - name: Run tests with coverage + run: | + pip install .[test] + ./tools/test + - name: Test Coverage + id: html_preview + uses: pavi2410/html-preview-action@v2 + with: + html_file: htmlcov/index.html From 0a6fc0e438357084b266b6f3894182836a3d6b83 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:17:36 +0000 Subject: [PATCH 03/12] try artifact --- .github/workflows/build_lint_test.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index caa43a9e..ed093325 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -1,4 +1,4 @@ -name: Pylint +name: ytld-sub build on: [push] @@ -26,8 +26,9 @@ jobs: run: | pip install .[test] ./tools/test - - name: Test Coverage - id: html_preview - uses: pavi2410/html-preview-action@v2 + - name: Upload test coverage + uses: actions/upload-artifact@v3 with: + name: test-coverage html_file: htmlcov/index.html + retention-days: 5 From 4c120393cb091e1a73b4cb5264aa0f4e0d64e0c9 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:19:10 +0000 Subject: [PATCH 04/12] path --- .github/workflows/build_lint_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index ed093325..99c7db71 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -30,5 +30,5 @@ jobs: uses: actions/upload-artifact@v3 with: name: test-coverage - html_file: htmlcov/index.html + path: htmlcov/index.html retention-days: 5 From 2ce413272ec367e1d20084566e2eb12e78e681e6 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:33:52 +0000 Subject: [PATCH 05/12] try xml --- .github/workflows/build_lint_test.yaml | 13 ++++++------- tools/test | 12 ++++++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index 99c7db71..e92e708c 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -22,13 +22,12 @@ jobs: run: | pip install .[lint] ./tools/linter check - - name: Run tests with coverage + - name: Run tests run: | pip install .[test] - ./tools/test - - name: Upload test coverage - uses: actions/upload-artifact@v3 + ./tools/test xml + - name: Report coverage + uses: 5monkeys/cobertura-action@master with: - name: test-coverage - path: htmlcov/index.html - retention-days: 5 + path: coverage.xml + repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/tools/test b/tools/test index dd8711ae..10dd7ab9 100755 --- a/tools/test +++ b/tools/test @@ -1,2 +1,10 @@ -# Run within root folder. Runs tests with coverage, and reports it to html -coverage run -m pytest && coverage html +# Run within root directory + +if [ $1 = "html" ]; then + coverage run -m pytest && coverage html +elif [ $1 = "xml" ]; then + coverage run -m pytest && coverage xml +else + coverage run -m pytest && coverage report +fi + From 747e803eff9eb91f4fcdfe4f04b0b0ae4044162b Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:36:39 +0000 Subject: [PATCH 06/12] min cov --- .github/workflows/build_lint_test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index e92e708c..e1e85860 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -31,3 +31,4 @@ jobs: with: path: coverage.xml repo_token: ${{ secrets.GITHUB_TOKEN }} + minimum_coverage: 5 # TODO: Add more tests From 367aa5967e9d6a892afeea79090ca70ecead8534 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:45:41 +0000 Subject: [PATCH 07/12] try lcov --- .github/workflows/build_lint_test.yaml | 8 ++++---- tools/test | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index e1e85860..1846fb0e 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -25,10 +25,10 @@ jobs: - name: Run tests run: | pip install .[test] - ./tools/test xml + ./tools/test lcov - name: Report coverage - uses: 5monkeys/cobertura-action@master + uses: zgosalvez/github-actions-report-lcov@v1 with: - path: coverage.xml + coverage-files: coverage.lcov + artifact-name: code-coverage-report repo_token: ${{ secrets.GITHUB_TOKEN }} - minimum_coverage: 5 # TODO: Add more tests diff --git a/tools/test b/tools/test index 10dd7ab9..0d71657b 100755 --- a/tools/test +++ b/tools/test @@ -2,8 +2,8 @@ if [ $1 = "html" ]; then coverage run -m pytest && coverage html -elif [ $1 = "xml" ]; then - coverage run -m pytest && coverage xml +elif [ $1 = "lcov" ]; then + coverage run -m pytest && coverage lcov else coverage run -m pytest && coverage report fi From 746a37ae429503b4186d02094a8912b0122ef5e5 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:48:23 +0000 Subject: [PATCH 08/12] token key --- .github/workflows/build_lint_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index 1846fb0e..cdbfde6f 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -31,4 +31,4 @@ jobs: with: coverage-files: coverage.lcov artifact-name: code-coverage-report - repo_token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} From 936e721fa2aabd3aa21d2212e3b1393102687d4b Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 07:58:07 +0000 Subject: [PATCH 09/12] try different workflow --- .github/workflows/build_lint_test.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index cdbfde6f..8e1e0f0f 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -27,8 +27,7 @@ jobs: pip install .[test] ./tools/test lcov - name: Report coverage - uses: zgosalvez/github-actions-report-lcov@v1 + uses: vebr/jest-lcov-reporter@v0.2.0 with: - coverage-files: coverage.lcov - artifact-name: code-coverage-report + lcov-file: coverage.lcov github-token: ${{ secrets.GITHUB_TOKEN }} From a24cbbf7098d9c5360a4028ae945fd7b8cfb32ad Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 08:01:47 +0000 Subject: [PATCH 10/12] no coverage :/ --- .github/workflows/build_lint_test.yaml | 11 +++-------- tools/test | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index 8e1e0f0f..d0b06021 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -1,4 +1,4 @@ -name: ytld-sub build +name: ytld-sub build, lint, test on: [push] @@ -22,12 +22,7 @@ jobs: run: | pip install .[lint] ./tools/linter check - - name: Run tests + - name: Run tests with coverage run: | pip install .[test] - ./tools/test lcov - - name: Report coverage - uses: vebr/jest-lcov-reporter@v0.2.0 - with: - lcov-file: coverage.lcov - github-token: ${{ secrets.GITHUB_TOKEN }} + ./tools/test diff --git a/tools/test b/tools/test index 0d71657b..71b26e1b 100755 --- a/tools/test +++ b/tools/test @@ -2,8 +2,6 @@ if [ $1 = "html" ]; then coverage run -m pytest && coverage html -elif [ $1 = "lcov" ]; then - coverage run -m pytest && coverage lcov else coverage run -m pytest && coverage report fi From 5b40ae49f3fb80c5d088e649c8f9f0d66210c997 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 08:04:22 +0000 Subject: [PATCH 11/12] install all deps at once --- .github/workflows/build_lint_test.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build_lint_test.yaml b/.github/workflows/build_lint_test.yaml index d0b06021..c0af307e 100644 --- a/.github/workflows/build_lint_test.yaml +++ b/.github/workflows/build_lint_test.yaml @@ -17,12 +17,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . + pip install .[lint,test] - name: Run linters run: | - pip install .[lint] ./tools/linter check - name: Run tests with coverage run: | - pip install .[test] ./tools/test From 761a42e5806316d9cb221beb97bb2541e02e2ae7 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 29 Apr 2022 08:08:58 +0000 Subject: [PATCH 12/12] bash fix --- tools/linter | 2 +- tools/test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/linter b/tools/linter index 6ddf8bcb..28394065 100755 --- a/tools/linter +++ b/tools/linter @@ -1,6 +1,6 @@ # Run within root directory -if [ $1 = "check" ]; then +if [[ $1 = "check" ]]; then isort . --check-only --diff \ && black . --check \ && pylint src/ \ diff --git a/tools/test b/tools/test index 71b26e1b..16915f28 100755 --- a/tools/test +++ b/tools/test @@ -1,6 +1,6 @@ # Run within root directory -if [ $1 = "html" ]; then +if [[ $1 = "html" ]]; then coverage run -m pytest && coverage html else coverage run -m pytest && coverage report