Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels authored Jan 13, 2024
2 parents b0c0141 + 55d520f commit f0ab952
Show file tree
Hide file tree
Showing 22 changed files with 513 additions and 184 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:

jobs:
UnitTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@cov
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
with:
name: sphinx-reports
python_version_list: "3.9 3.10 3.11 3.12 pypy-3.9 pypy-3.10"
# disable_list: "windows:pypy-3.8 windows:pypy-3.9 windows:pypy-3.10"

UnitTesting:
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@cov
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev
needs:
- UnitTestingParams
with:
Expand All @@ -24,7 +24,7 @@ jobs:
coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}

DocCoverage:
uses: pyTooling/Actions/.github/workflows/CheckDocumentation.yml@cov
uses: pyTooling/Actions/.github/workflows/CheckDocumentation.yml@dev
needs:
- UnitTestingParams
with:
Expand All @@ -33,7 +33,7 @@ jobs:
# fail_below: 70

Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@cov
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
needs:
- UnitTestingParams
- UnitTesting
Expand All @@ -42,7 +42,7 @@ jobs:
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}

StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@cov
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev
needs:
- UnitTestingParams
with:
Expand All @@ -53,7 +53,7 @@ jobs:
html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}

PublishCoverageResults:
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@cov
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@dev
needs:
- UnitTestingParams
- UnitTesting
Expand All @@ -66,41 +66,47 @@ jobs:
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}

PublishTestResults:
uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@cov
uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@dev
needs:
- UnitTestingParams
- UnitTesting
with:
merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}

IntermediateCleanUp:
uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@cov
uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@dev
needs:
- UnitTestingParams
- PublishCoverageResults
- PublishTestResults
- HTMLDocumentation
with:
sqlite_coverage_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}-
xml_unittest_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}-

# VerifyDocs:
# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@cov
# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@dev
# needs:
# - UnitTestingParams
# with:
# python_version: ${{ needs.UnitTestingParams.outputs.python_version }}

HTMLDocumentation:
uses: pyTooling/Actions/.github/workflows/SphinxDocumentation.yml@cov
uses: pyTooling/Actions/.github/workflows/SphinxDocumentation.yml@dev
needs:
- UnitTestingParams
- PublishTestResults
- PublishCoverageResults
# - VerifyDocs
with:
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}-ubuntu-native-3.12
coverage_json_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }}
html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }}
latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }}

PDFDocumentation:
uses: pyTooling/Actions/.github/workflows/LaTeXDocumentation.yml@cov
uses: pyTooling/Actions/.github/workflows/LaTeXDocumentation.yml@dev
needs:
- UnitTestingParams
- HTMLDocumentation
Expand All @@ -110,7 +116,7 @@ jobs:
pdf_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_pdf }}

PublishToGitHubPages:
uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@cov
uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@dev
needs:
- UnitTestingParams
- HTMLDocumentation
Expand All @@ -123,15 +129,15 @@ jobs:
typing: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}

ReleasePage:
uses: pyTooling/Actions/.github/workflows/Release.yml@cov
uses: pyTooling/Actions/.github/workflows/Release.yml@dev
if: startsWith(github.ref, 'refs/tags')
needs:
# - StaticTypeCheck
- Package
- PublishToGitHubPages

PublishOnPyPI:
uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@cov
uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@dev
if: startsWith(github.ref, 'refs/tags')
needs:
- UnitTestingParams
Expand All @@ -144,7 +150,7 @@ jobs:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

ArtifactCleanUp:
uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@cov
uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@dev
needs:
- UnitTestingParams
- UnitTesting
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Supported format reports are:
* 🚧 Code coverage (by [Coverage.py](https://github.com/nedbat/coveragepy))
* ✅ Summary page (displaying `coverage.json`)
* 🚧 Highlighted source code
* 🚧 Unit Test summaries (by [pytest](https://github.com/pytest-dev/pytest))
* ✅🚧 Unit Test summaries (by [pytest](https://github.com/pytest-dev/pytest))
* ✅ Summary page (displaying `unittest.xml`)
* 🚧 Show logging, output and error messages.
* 🚧 Dependencies (reading `requirements.txt` files)

![Code Coverage Summary Page](.github/CodeCoverage.png)
Expand Down
2 changes: 1 addition & 1 deletion doc/CodeCov/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ bar.
:hidden:
sphinx_reports/sphinx_reports
Unittest Report ➚ <unittests/index>
unittests/index
coverage/index
Doc. Coverage Report <DocCoverage>
Static Type Check Report ➚ <typing/index>
Expand Down
2 changes: 1 addition & 1 deletion doc/DocCov/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bar.
:hidden:
sphinx_reports/sphinx_reports
Unittest Report ➚ <unittests/index>
unittests/index
coverage/index
Doc. Coverage Report <DocCoverage>
Static Type Check Report ➚ <typing/index>
Expand Down
106 changes: 106 additions & 0 deletions doc/Unittest/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,109 @@ Unit Test Summary
#################

🚧 This is a planned feature. 🚧

.. #:term:`Unittests` checks if a source code was used during execution. Usually, testcases are run by a testcase
execution framework like `pytest <https://github.com/pytest-dev/pytest>`__.


.. _UNITTEST/Quick:

Quick Configuration
*******************

See the :ref:`overview page <OVER>` on how to setup and enable the Sphinx extension in general.

.. note:: This is a quick and minimal configuration. See below detailed explanations.

1. Configure one or more unitest summary reports in :file:`conf.py` by adding a new 'section' defining some
configuration variables. Each summary report is identified by an ID, which is later referred to by the report
directive. Here, the ID is called ``src`` (dictionary key). Each analysis report needs 2 configuration entries:

``name``
Name of the Python package[#PkgNameVsPkgDir]_.

``xml_report``
The code coverage report as JSON file as generated by *Coverage.py*.

.. code-block:: Python
# ==============================================================================
# Sphinx-reports - DocCov
# ==============================================================================
report_codecov_packages = {
"src": {
"name": "myPackage",
"xml_report": "../report/unit/unittest.xml",
}
}
2. Add the :rst:dir:`unittest-summary` directive into your Restructured Text (ReST) document.

.. code-block:: ReST
.. report:unittest-summary::
:reportid: src
.. _UNITTEST/Example:

Example Document
****************

The following ``unittest/index`` document is an example on how this documentation uses the :rst:dir:`unittest-summary`
directive. The first file consists of three parts: At first, a headline; at second second a short introduction paragraph
and at third, the report generating directive. The second file shows how to integrate that document into the navigation
bar.

.. admonition:: :file:`unittest/index.rst`

.. code-block:: ReST
Unittest Summary Report
#######################
Code coverage report generated with ``pytest``.
.. report:unittest-summary::
:reportid: src
.. admonition:: :file:`index.rst`

.. code-block:: ReST
.. toctree::
:caption: References and Reports
:hidden:
sphinx_reports/sphinx_reports
unittests/index
coverage/index
Doc. Coverage Report <DocCoverage>
Static Type Check Report ➚ <typing/index>
.. toctree::
:caption: Appendix
:hidden:
.. _UNITTEST/Directives:

Directives
**********

.. rst:directive:: unittest-summary
Add a table summarizing the unittest results.

.. rst:directive:option:: reportid
An identifier referencing a dictionary entry in the configuration variable ``report_unittest_testsuites`` defined
in :file:`conf.py`.
.. _UNITTEST/Roles:

Roles
*****

*There are no roles defined.*
6 changes: 6 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@
"error": {"class": "report-cov-error", "desc": "internal error"},
}

report_unittest_testsuites = {
"src": {
"name": "sphinx_reports",
"xml_report": "../report/unit/TestReportSummary.xml",
}
}
report_codecov_packages = {
"src": {
"name": "sphinx_reports",
Expand Down
2 changes: 1 addition & 1 deletion doc/coverage/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Code Coverage Report
####################

Code coverage report generated with ``pytest`` *and* ``coverage.py``.
Code coverage report generated with ``pytest`` and ``coverage.py``.

.. report:code-coverage::
:packageid: src
18 changes: 12 additions & 6 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ Supported format reports are:
* ✅ Summary page
* 🚧 Highlighted source code

* 🚧 Unit Test summaries (by `pytest`)
* ✅🚧 Unit Test summaries (by `pytest <https://github.com/pytest-dev/pytest>`__)

* ✅ Summary page (displaying `unittest.xml`)
* 🚧 Show logging, output and error messages.

* 🚧 Dependencies (reading `requirements.txt` files)

Documentation coverage
Expand All @@ -105,20 +109,22 @@ documentation coverage can be computed.
Code Coverage
=============

🚧 This is a work-in-progress feature. 🚧

:ref:`CODECOV` checks if a source code was used during execution. Usually, testcases are run by a testcase execution
framework like `pytest <https://github.com/pytest-dev/pytest>`__, which also offers to instrument the code for code
coverage collection using the ``pytest-cov`` plugin. For Python, coverage collection is usually based on
`Coverage.py <https://github.com/nedbat/coveragepy>`__, which supports statement and branch coverage collection.

.. todo:: index: Screen shot here and link to this coverage report.
.. todo:: index: Screen shot here and link to this code coverage report.


Unit Test Summary
=================

🚧 This is a planned feature. 🚧
🚧 This is a work-in-progress feature. 🚧

:ref:`UNITTEST`

.. todo:: index: Screen shot here and link to this unitest summary.


Dependencies
Expand Down Expand Up @@ -185,7 +191,7 @@ License
:hidden:

Python Class Reference <sphinx_reports/sphinx_reports>
Unittest Report ➚ <unittests/index>
unittests/index
coverage/index
Doc. Coverage Report <DocCoverage>
Static Type Check Report ➚ <typing/index>
Expand Down
9 changes: 6 additions & 3 deletions doc/unittests/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
UnitTest Report
###############
Unittest Summary Report
#######################

*Placeholder for the unittest report generated with* ``pytest``.
Code coverage report generated with `pytest <https://github.com/pytest-dev/pytest>`__.

.. report:unittest-summary::
:reportid: src
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ filterwarnings = [
"error::DeprecationWarning",
"error::PendingDeprecationWarning"
]
junit_logging = "all"
junit_suite_name = "sphinx_reports"

[tool.interrogate]
color = true
Expand Down
Loading

0 comments on commit f0ab952

Please sign in to comment.