Skip to content

Commit

Permalink
Added project infrastructure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jan 8, 2024
1 parent 182d376 commit 8ce0385
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 0 deletions.
136 changes: 136 additions & 0 deletions .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Pipeline

on:
push:
workflow_dispatch:
schedule:
- cron: '0 0 * * 5'

jobs:
Params:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
with:
name: sphinx-reports
system_list: "ubuntu"

UnitTesting:
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev
needs:
- Params
with:
jobs: ${{ needs.Params.outputs.python_jobs }}
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }}

Coverage:
uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@dev
needs:
- Params
with:
python_version: ${{ needs.Params.outputs.python_version }}
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }}
secrets:
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}

StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev
needs:
- Params
with:
python_version: ${{ needs.Params.outputs.python_version }}
commands: |
mypy --html-report htmlmypy -p sphinx-reports
html_report: 'htmlmypy'
html_artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }}

PublishTestResults:
uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@dev
needs:
- UnitTesting

Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@dev
needs:
- Params
- Coverage
with:
python_version: ${{ needs.Params.outputs.python_version }}
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }}

AppTesting:
uses: pyTooling/Actions/.github/workflows/ApplicationTesting.yml@dev
needs:
- Params
- Package
with:
jobs: ${{ needs.Params.outputs.python_jobs }}
wheel: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }}
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).apptesting_xml }}

Release:
uses: pyTooling/Actions/.github/workflows/Release.yml@dev
if: startsWith(github.ref, 'refs/tags')
needs:
- Coverage
- AppTesting
- StaticTypeCheck

PublishOnPyPI:
uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@dev
if: startsWith(github.ref, 'refs/tags')
needs:
- Params
- Release
- Package
with:
python_version: ${{ needs.Params.outputs.python_version }}
requirements: -r dist/requirements.txt
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }}
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

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

BuildTheDocs:
uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@dev
needs:
- Params
# - VerifyDocs
with:
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }}

PublishToGitHubPages:
uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@dev
needs:
- Params
- BuildTheDocs
- Coverage
- StaticTypeCheck
with:
doc: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }}
coverage: ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }}
typing: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }}

ArtifactCleanUp:
uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@dev
needs:
- Params
- UnitTesting
- AppTesting
- Coverage
- StaticTypeCheck
- BuildTheDocs
- PublishToGitHubPages
- PublishTestResults
with:
package: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }}
remaining: |
${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }}-*
${{ fromJson(needs.Params.outputs.artifact_names).apptesting_xml }}
${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }}
${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }}
${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }}
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = [
"pyTooling >= 5.0.0",
"setuptools >= 68.0.0",
"wheel >= 0.40.0"
]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 120

[tool.mypy]
python_version = "3.12"
namespace_packages = true

pretty = true
show_error_context = true

html_report = "report/typing"

[tool.pytest.ini_options]
# Don't set 'python_classes = *' otherwise, pytest doesn't search for classes
# derived from unittest.Testcase
python_files = "*"
python_functions = "test_*"
filterwarnings = [
"error::DeprecationWarning",
"error::PendingDeprecationWarning"
]

[tool.coverage.run]
branch = true
omit = [
"*site-packages*",
"setup.py",
"tests/*"
]

[tool.coverage.report]
skip_covered = false
skip_empty = true
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError"
]
omit = [
"tests/*"
]

[tool.coverage.html]
directory = "report/coverage/html"
title="Code Coverage of pyTooling"

[tool.coverage.xml]
output = "report/coverage/coverage.xml"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyTooling ~= 5.0
45 changes: 45 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ==================================================================================================================== #
# _ _ _ #
# ___ _ __ | |__ (_)_ __ __ __ _ __ ___ _ __ ___ _ __| |_ ___ #
# / __| '_ \| '_ \| | '_ \\ \/ /____| '__/ _ \ '_ \ / _ \| '__| __/ __| #
# \__ \ |_) | | | | | | | |> <_____| | | __/ |_) | (_) | | | |_\__ \ #
# |___/ .__/|_| |_|_|_| |_/_/\_\ |_| \___| .__/ \___/|_| \__|___/ #
# |_| |_| #
# ==================================================================================================================== #
# Authors: #
# Patrick Lehmann #
# #
# License: #
# ==================================================================================================================== #
# Copyright 2023-2024 Patrick Lehmann - Bötzingen, Germany #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# #
# SPDX-License-Identifier: Apache-2.0 #
# ==================================================================================================================== #
#
"""Package installer for 'Write version information for any programming language as source file'."""
from pathlib import Path
from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub

gitHubNamespace = "pyTooling"
packageName = "sphinx-reports"
packageDirectory = packageName.replace(".", "/")
packageInformationFile = Path(f"{packageDirectory}/__init__.py")

DescribePythonPackageHostedOnGitHub(
packageName=packageName,
description="A Sphinx extension providing coverage details embedded in documentation pages.",
gitHubNamespace=gitHubNamespace,
sourceFileWithVersion=packageInformationFile,
)

0 comments on commit 8ce0385

Please sign in to comment.