From 3398b0e15a3d8e283026cd779c71cec475807a15 Mon Sep 17 00:00:00 2001 From: Bhosale Date: Wed, 20 Jul 2022 02:16:36 -0500 Subject: [PATCH 1/2] refac: remove poetry redundancy --- .coveragerc | 2 + .github/workflows/ci-sphinx.yml | 66 ++++++++++++++++++++------------- .github/workflows/main.yml | 2 +- Makefile | 8 ++-- docs/requirements.txt | 13 ------- pyproject.toml | 13 ------- tests/requirements.txt | 8 ---- 7 files changed, 48 insertions(+), 64 deletions(-) delete mode 100644 docs/requirements.txt delete mode 100644 tests/requirements.txt diff --git a/.coveragerc b/.coveragerc index e9f3f11c..6720cf46 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,6 +4,8 @@ exclude_lines = # Don't complain if non-runnable code isn't run: if 0: if __name__ == __main__: +fail_under = 40 +show_missing = true [run] branch = True diff --git a/.github/workflows/ci-sphinx.yml b/.github/workflows/ci-sphinx.yml index 6256e789..dd0cc58f 100644 --- a/.github/workflows/ci-sphinx.yml +++ b/.github/workflows/ci-sphinx.yml @@ -22,30 +22,46 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - - name: Poetry Setup - run: | - apt-get update -y && apt-get install curl - make poetry-download - poetry --version - poetry config virtualenvs.in-project false - poetry config virtualenvs.create false - poetry install -E docs - - - name: Sphinx Build Check + - name: Setup Poetry + uses: Gr1N/setup-poetry@v7 + with: + poetry-preview: false + - name: Export requirements file for sphinx run: | - cd docs - make clean - if ! (make html SPHINXOPTS="-W --keep-going") ; then - echo Please resolve the warnings/errors - exit 1 - else - echo Doc build success - exit 0 - fi + poetry export -E docs --without-hashes -f requirements.txt --output docs/requirements.txt - - name: Sphinx Link Check - run: | - cd docs - make clean - make linkcheck + - name: Sphinx Build + # You may pin to the exact commit or the version. + # uses: ammaraskar/sphinx-action@8b4f60114d7fd1faeba1a712269168508d4750d2 + uses: ammaraskar/sphinx-action@0.4 + with: + # The folder containing your sphinx docs. + docs-folder: docs/ + # The command used to build your documentation. + build-command: make html SPHINXOPTS="-W --keep-going" # -n" +# - name: Poetry Setup +# run: | +# apt-get update -y && apt-get install curl +# make poetry-download +# poetry --version +# poetry config virtualenvs.in-project false +# poetry config virtualenvs.create false +# poetry install -E docs +# +# - name: Sphinx Build Check +# run: | +# cd docs +# make clean +# if ! (make html SPHINXOPTS="-W --keep-going") ; then +# echo Please resolve the warnings/errors +# exit 1 +# else +# echo Doc build success +# exit 0 +# fi +# +# - name: Sphinx Link Check +# run: | +# cd docs +# make clean +# make linkcheck diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0585bc5..5380aa24 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,7 +74,7 @@ jobs: - name: Test MiV-OS using pytest if: startsWith(runner.os, 'macOS') run: | - poetry run pytest -c pyproject.toml --cov=miv --cov-report=xml + make test_ci - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: diff --git a/Makefile b/Makefile index b147471d..9c5aca6c 100644 --- a/Makefile +++ b/Makefile @@ -35,11 +35,11 @@ formatting: codestyle #* Linting .PHONY: test test: - PYTHONPATH=$(PYTHONPATH) poetry run pytest -c pyproject.toml --cov-report=html --cov=miv tests/ + poetry run pytest -c pyproject.toml --cov=miv -.PHONY: coverage check -coverage: - PYTHONPATH=$(PYTHONPATH) poetry run pytest -c pyproject.toml --cov=miv tests/ +.PHONY: test_ci +test_ci: + poetry run pytest -c pyproject.toml --cov=miv --cov-report=xml .PHONY: check-codestyle check-codestyle: diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 85691b0f..00000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -# File: docs/requirements.txt - -docutils -myst-nb -myst-parser -numpydoc -readthedocs-sphinx-search==0.1.1 -sphinx==4.4.0 -sphinx-autodoc-typehints -sphinx-book-theme -sphinx-copybutton -sphinx-togglebutton -sphinx_rtd_theme==1.0.0 diff --git a/pyproject.toml b/pyproject.toml index b6d151b1..61695556 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -168,16 +168,3 @@ addopts = [ # "--doctest-modules", TODO: Try to include pytest.doctest # "--doctest-continue-on-failure", ] - -[tool.coverage.run] -source = ["tests"] - -[coverage.paths] -source = "miv" - -[coverage.run] -branch = true - -[coverage.report] -fail_under = 50 -show_missing = true diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index df41f246..00000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -black==21.12b0 -click==8.0.4 -codecov -flake8==3.8.3 -mypy -pylint -pytest -pytest-cov From 7ff8383e7c295e30e38165abb952f618eb6102d6 Mon Sep 17 00:00:00 2001 From: Bhosale Date: Wed, 20 Jul 2022 02:36:38 -0500 Subject: [PATCH 2/2] refac: revert to previous CI --- .github/workflows/ci-sphinx.yml | 59 ++++++++++++--------------------- 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci-sphinx.yml b/.github/workflows/ci-sphinx.yml index dd0cc58f..6d4b7a21 100644 --- a/.github/workflows/ci-sphinx.yml +++ b/.github/workflows/ci-sphinx.yml @@ -26,42 +26,27 @@ jobs: uses: Gr1N/setup-poetry@v7 with: poetry-preview: false - - name: Export requirements file for sphinx + - name: Poetry install docs dependencies run: | - poetry export -E docs --without-hashes -f requirements.txt --output docs/requirements.txt + poetry --version + poetry config virtualenvs.in-project false + poetry config virtualenvs.create false + poetry install -E docs - - name: Sphinx Build - # You may pin to the exact commit or the version. - # uses: ammaraskar/sphinx-action@8b4f60114d7fd1faeba1a712269168508d4750d2 - uses: ammaraskar/sphinx-action@0.4 - with: - # The folder containing your sphinx docs. - docs-folder: docs/ - # The command used to build your documentation. - build-command: make html SPHINXOPTS="-W --keep-going" # -n" -# - name: Poetry Setup -# run: | -# apt-get update -y && apt-get install curl -# make poetry-download -# poetry --version -# poetry config virtualenvs.in-project false -# poetry config virtualenvs.create false -# poetry install -E docs -# -# - name: Sphinx Build Check -# run: | -# cd docs -# make clean -# if ! (make html SPHINXOPTS="-W --keep-going") ; then -# echo Please resolve the warnings/errors -# exit 1 -# else -# echo Doc build success -# exit 0 -# fi -# -# - name: Sphinx Link Check -# run: | -# cd docs -# make clean -# make linkcheck + - name: Sphinx Build Check + run: | + cd docs + make clean + if ! (make html SPHINXOPTS="-W --keep-going") ; then + echo Please resolve the warnings/errors + exit 1 + else + echo Doc build success + exit 0 + fi + + - name: Sphinx Link Check + run: | + cd docs + make clean + make linkcheck