mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
Testing Workflow Templates with Dummy Project
This commit is contained in:
2
.github/workflows/ApplicationTesting.yml
vendored
2
.github/workflows/ApplicationTesting.yml
vendored
@@ -82,7 +82,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 📥 Download artifacts '${{ inputs.wheel }}' from 'Package' job
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
2
.github/workflows/BuildTheDocs.yml
vendored
2
.github/workflows/BuildTheDocs.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🛳️ Build documentation
|
||||
uses: buildthedocs/btd@v0
|
||||
|
||||
3
.github/workflows/CoverageCollection.yml
vendored
3
.github/workflows/CoverageCollection.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🐍 Setup Python ${{ inputs.python_version }}
|
||||
uses: actions/setup-python@v4
|
||||
@@ -131,6 +131,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
run: |
|
||||
export ENVIRONMENT_NAME="Linux (x86-64)"
|
||||
export PYTHONPATH=$(pwd)
|
||||
ABSDIR=$(pwd)
|
||||
cd "${{ inputs.tests_directory || '.' }}"
|
||||
[ -n '${{ inputs.coverage_config }}' ] && PYCOV_ARGS="--cov-config=${ABSDIR}/${{ inputs.coverage_config }}" || unset PYCOV_ARGS
|
||||
|
||||
2
.github/workflows/Package.yml
vendored
2
.github/workflows/Package.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🐍 Setup Python ${{ inputs.python_version }}
|
||||
uses: actions/setup-python@v4
|
||||
|
||||
3
.github/workflows/Pipeline.yml
vendored
3
.github/workflows/Pipeline.yml
vendored
@@ -1,4 +1,5 @@
|
||||
name: Pipeline
|
||||
#name: Pipeline
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
67
.github/workflows/PublishCoverageResults.yml
vendored
Normal file
67
.github/workflows/PublishCoverageResults.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# ==================================================================================================================== #
|
||||
# Authors: #
|
||||
# Patrick Lehmann #
|
||||
# #
|
||||
# ==================================================================================================================== #
|
||||
# Copyright 2020-2023 The pyTooling Authors #
|
||||
# #
|
||||
# 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 #
|
||||
# ==================================================================================================================== #
|
||||
name: Publish Unit Test Results
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
report_files:
|
||||
description: 'Pattern of report files to upload. Can be a comma separated list.'
|
||||
required: false
|
||||
default: 'artifacts/**/*.xml'
|
||||
type: string
|
||||
secrets:
|
||||
codacy_token:
|
||||
description: 'Token to push result to codacy.'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
PublishTestResults:
|
||||
name: 📊 Publish Test Results
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: 📊 Publish code coverage at CodeCov
|
||||
if: inputs.CodeCov == true
|
||||
continue-on-error: true
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: ${{ steps.getVariables.outputs.coverage_report_xml }}
|
||||
flags: unittests
|
||||
env_vars: PYTHON
|
||||
|
||||
- name: 📉 Publish code coverage at Codacy
|
||||
if: inputs.Codacy == true
|
||||
continue-on-error: true
|
||||
uses: codacy/codacy-coverage-reporter-action@v1
|
||||
with:
|
||||
project-token: ${{ secrets.codacy_token }}
|
||||
coverage-reports: ${{ steps.getVariables.outputs.coverage_report_xml }}
|
||||
2
.github/workflows/PublishTestResults.yml
vendored
2
.github/workflows/PublishTestResults.yml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
2
.github/workflows/PublishToGitHubPages.yml
vendored
2
.github/workflows/PublishToGitHubPages.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 📥 Download artifacts '${{ inputs.doc }}' from 'BuildTheDocs' job
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
2
.github/workflows/StaticTypeCheck.yml
vendored
2
.github/workflows/StaticTypeCheck.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🐍 Setup Python ${{ inputs.python_version }}
|
||||
uses: actions/setup-python@v4
|
||||
|
||||
6
.github/workflows/TestReleaser.yml
vendored
6
.github/workflows/TestReleaser.yml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
env:
|
||||
DOCKER_BUILDKIT: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build container image
|
||||
run: docker build -t ghcr.io/pytooling/releaser -f releaser/Dockerfile releaser
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
Composite:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: echo "Build some tool and generate some (versioned) artifacts" > artifact-$(date -u +"%Y-%m-%dT%H-%M-%SZ").txt
|
||||
|
||||
@@ -122,7 +122,7 @@ jobs:
|
||||
- Composite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: echo "Build some tool and generate some (versioned) artifacts" > artifact-$(date -u +"%Y-%m-%dT%H-%M-%SZ").txt
|
||||
|
||||
|
||||
10
.github/workflows/UnitTesting.yml
vendored
10
.github/workflows/UnitTesting.yml
vendored
@@ -77,7 +77,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Compute pacman/pacboy packages
|
||||
id: pacboy
|
||||
@@ -192,19 +192,23 @@ jobs:
|
||||
if: matrix.system == 'windows'
|
||||
run: |
|
||||
$env:ENVIRONMENT_NAME = "${{ matrix.envname }}"
|
||||
$env:PYTHONPATH = (Get-Location).ToString()
|
||||
cd "${{ inputs.tests_directory || '.' }}"
|
||||
$PYTEST_ARGS = if ("${{ inputs.artifact }}") { "--junitxml=TestReportSummary.xml" } else { "" }
|
||||
python -m pytest -rA ${{ inputs.unittest_directory }} $PYTEST_ARGS --color=yes
|
||||
Write-Host "python -m pytest -rA $PYTEST_ARGS --color=yes ${{ inputs.unittest_directory }}"
|
||||
python -m pytest -rA $PYTEST_ARGS --color=yes ${{ inputs.unittest_directory }}
|
||||
|
||||
- name: ☑ Run unit tests (Ubuntu/macOS)
|
||||
if: matrix.system != 'windows'
|
||||
run: |
|
||||
export ENVIRONMENT_NAME="${{ matrix.envname }}"
|
||||
export PYTHONPATH=$(pwd)
|
||||
ABSDIR=$(pwd)
|
||||
cd "${{ inputs.tests_directory || '.' }}"
|
||||
[ -n '${{ inputs.coverage_config }}' ] && PYCOV_ARGS="--cov-config=${ABSDIR}/${{ inputs.coverage_config }}" || unset PYCOV_ARGS
|
||||
[ -n '${{ inputs.artifact }}' ] && PYTEST_ARGS='--junitxml=TestReportSummary.xml' || unset PYTEST_ARGS
|
||||
python -m pytest -rA ${{ inputs.unittest_directory }} $PYTEST_ARGS --color=yes
|
||||
echo "python -m pytest -rA $PYTEST_ARGS --color=yes ${{ inputs.unittest_directory }}"
|
||||
python -m pytest -rA $PYTEST_ARGS --color=yes ${{ inputs.unittest_directory }}
|
||||
|
||||
- name: 📤 Upload 'TestReportSummary.xml' artifact
|
||||
if: inputs.artifact != ''
|
||||
|
||||
2
.github/workflows/VerifyDocs.yml
vendored
2
.github/workflows/VerifyDocs.yml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: ⏬ Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🐍 Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
|
||||
155
.github/workflows/_Checking_Pipeline.yml
vendored
Normal file
155
.github/workflows/_Checking_Pipeline.yml
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
name: Verification of Complete Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
UnitTestingParams:
|
||||
uses: pyTooling/Actions/.github/workflows/Parameters.yml@cov
|
||||
with:
|
||||
name: pyDummy
|
||||
python_version_list: "3.11"
|
||||
# python_version_list: "3.7 3.8 pypy-3.8 3.9 pypy-3.9 3.10 3.11"
|
||||
exclude_list: "windows:pypy-3.8 windows:pypy-3.9"
|
||||
# disable_list: "windows:3.11"
|
||||
|
||||
PlatformTestingParams:
|
||||
uses: pyTooling/Actions/.github/workflows/Parameters.yml@cov
|
||||
with:
|
||||
name: Platform
|
||||
python_version_list: ""
|
||||
system_list: "ubuntu"
|
||||
# system_list: "ubuntu windows macos mingw32 mingw64 clang64 ucrt64"
|
||||
|
||||
UnitTesting:
|
||||
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@cov
|
||||
needs:
|
||||
- UnitTestingParams
|
||||
with:
|
||||
jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }}
|
||||
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}
|
||||
|
||||
PlatformTesting:
|
||||
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@cov
|
||||
needs:
|
||||
- PlatformTestingParams
|
||||
with:
|
||||
jobs: ${{ needs.PlatformTestingParams.outputs.python_jobs }}
|
||||
tests_directory: ""
|
||||
unittest_directory: tests/unit/Platform
|
||||
artifact: ${{ fromJson(needs.PlatformTestingParams.outputs.artifact_names).unittesting_xml }}
|
||||
|
||||
Coverage:
|
||||
uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@cov
|
||||
needs:
|
||||
- UnitTestingParams
|
||||
with:
|
||||
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
||||
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }}
|
||||
secrets:
|
||||
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
|
||||
PublishCoverageResults:
|
||||
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@cov
|
||||
needs:
|
||||
- UnitTesting
|
||||
- Coverage
|
||||
secrets:
|
||||
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
|
||||
StaticTypeCheck:
|
||||
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@cov
|
||||
needs:
|
||||
- UnitTestingParams
|
||||
with:
|
||||
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
||||
commands: |
|
||||
mypy --html-report htmlmypy -p pyDummy
|
||||
html_report: 'htmlmypy'
|
||||
html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}
|
||||
|
||||
PublishTestResults:
|
||||
uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@cov
|
||||
needs:
|
||||
- UnitTesting
|
||||
|
||||
Package:
|
||||
uses: pyTooling/Actions/.github/workflows/Package.yml@cov
|
||||
needs:
|
||||
- UnitTestingParams
|
||||
- Coverage
|
||||
- PlatformTesting
|
||||
with:
|
||||
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
||||
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
||||
|
||||
Release:
|
||||
uses: pyTooling/Actions/.github/workflows/Release.yml@cov
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
needs:
|
||||
- UnitTesting
|
||||
- Coverage
|
||||
- StaticTypeCheck
|
||||
- Package
|
||||
|
||||
PublishOnPyPI:
|
||||
uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@cov
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
needs:
|
||||
- UnitTestingParams
|
||||
- Release
|
||||
- Package
|
||||
with:
|
||||
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
||||
requirements: -r dist/requirements.txt
|
||||
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
||||
secrets:
|
||||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
|
||||
# VerifyDocs:
|
||||
# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@cov
|
||||
# needs:
|
||||
# - UnitTestingParams
|
||||
# with:
|
||||
# python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
|
||||
|
||||
# BuildTheDocs:
|
||||
# uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@cov
|
||||
# needs:
|
||||
# - UnitTestingParams
|
||||
## - VerifyDocs
|
||||
# with:
|
||||
# artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }}
|
||||
|
||||
PublishToGitHubPages:
|
||||
uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@cov
|
||||
needs:
|
||||
- UnitTestingParams
|
||||
# - BuildTheDocs
|
||||
- Coverage
|
||||
- StaticTypeCheck
|
||||
with:
|
||||
doc: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }}
|
||||
coverage: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }}
|
||||
typing: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}
|
||||
|
||||
ArtifactCleanUp:
|
||||
uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@cov
|
||||
needs:
|
||||
- UnitTestingParams
|
||||
- UnitTesting
|
||||
- PlatformTesting
|
||||
- Coverage
|
||||
- StaticTypeCheck
|
||||
# - BuildTheDocs
|
||||
- PublishToGitHubPages
|
||||
- PublishCoverageResults
|
||||
- PublishTestResults
|
||||
with:
|
||||
package: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
|
||||
remaining: |
|
||||
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}-*
|
||||
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }}
|
||||
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}
|
||||
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }}
|
||||
@@ -85,7 +85,7 @@ The following block shows a minimal YAML workflow file:
|
||||
steps:
|
||||
|
||||
# Clone repository
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Build your application, tool, artifacts, etc.
|
||||
- name: Build
|
||||
|
||||
51
pyDummy/__init__.py
Normal file
51
pyDummy/__init__.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# ==================================================================================================================== #
|
||||
# _____ _ _ _ _ _ #
|
||||
# _ __ _ |_ _|__ ___ | (_)_ __ __ _ / \ ___| |_(_) ___ _ __ ___ #
|
||||
# | '_ \| | | || |/ _ \ / _ \| | | '_ \ / _` | / _ \ / __| __| |/ _ \| '_ \/ __| #
|
||||
# | |_) | |_| || | (_) | (_) | | | | | | (_| |_ / ___ \ (__| |_| | (_) | | | \__ \ #
|
||||
# | .__/ \__, ||_|\___/ \___/|_|_|_| |_|\__, (_)_/ \_\___|\__|_|\___/|_| |_|___/ #
|
||||
# |_| |___/ |___/ #
|
||||
# ==================================================================================================================== #
|
||||
# Authors: #
|
||||
# Patrick Lehmann #
|
||||
# #
|
||||
# License: #
|
||||
# ==================================================================================================================== #
|
||||
# Copyright 2017-2023 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 #
|
||||
# ==================================================================================================================== #
|
||||
#
|
||||
__author__ = "Patrick Lehmann"
|
||||
__email__ = "Paebbels@gmail.com"
|
||||
__copyright__ = "2017-2023, Patrick Lehmann"
|
||||
__license__ = "Apache License, Version 2.0"
|
||||
__version__ = "0.1.0"
|
||||
__keywords__ = ["dummy"]
|
||||
__issue_tracker__ = "https://GitHub.com/pyTooling/Actions/issues"
|
||||
|
||||
from pyTooling.Decorators import export
|
||||
|
||||
|
||||
@export
|
||||
class Application:
|
||||
_value: int
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._value = 1
|
||||
|
||||
@property
|
||||
def Value(self) -> int:
|
||||
return self._value
|
||||
0
pyDummy/py.typed
Normal file
0
pyDummy/py.typed
Normal file
60
pyproject.toml
Normal file
60
pyproject.toml
Normal file
@@ -0,0 +1,60 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"setuptools >= 68.0.0",
|
||||
"wheel >= 0.40.0",
|
||||
"pyTooling >= 5.0.0"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.black]
|
||||
line-length = 120
|
||||
|
||||
[tool.mypy]
|
||||
files = ["pyDummy"]
|
||||
python_version = "3.11"
|
||||
#ignore_missing_imports = true
|
||||
strict = true
|
||||
pretty = true
|
||||
show_error_context = true
|
||||
show_error_codes = true
|
||||
namespace_packages = 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.xml]
|
||||
output = "report/coverage/coverage.xml"
|
||||
|
||||
[tool.coverage.json]
|
||||
output = "report/coverage/coverage.json"
|
||||
|
||||
[tool.coverage.html]
|
||||
directory = "report/coverage/html"
|
||||
title="Code Coverage of pyDummy"
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
# Clone repository
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Build your application, tool, artifacts, etc.
|
||||
- name: Build
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pyTooling >= 5.0.0, <6.0.0
|
||||
|
||||
50
setup.py
Normal file
50
setup.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# ==================================================================================================================== #
|
||||
# _____ _ _ _ _ _ #
|
||||
# _ __ _ |_ _|__ ___ | (_)_ __ __ _ / \ ___| |_(_) ___ _ __ ___ #
|
||||
# | '_ \| | | || |/ _ \ / _ \| | | '_ \ / _` | / _ \ / __| __| |/ _ \| '_ \/ __| #
|
||||
# | |_) | |_| || | (_) | (_) | | | | | | (_| |_ / ___ \ (__| |_| | (_) | | | \__ \ #
|
||||
# | .__/ \__, ||_|\___/ \___/|_|_|_| |_|\__, (_)_/ \_\___|\__|_|\___/|_| |_|___/ #
|
||||
# |_| |___/ |___/ #
|
||||
# ==================================================================================================================== #
|
||||
# Authors: #
|
||||
# Patrick Lehmann #
|
||||
# #
|
||||
# License: #
|
||||
# ==================================================================================================================== #
|
||||
# Copyright 2017-2023 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 #
|
||||
# ==================================================================================================================== #
|
||||
#
|
||||
from setuptools import setup
|
||||
|
||||
from pathlib import Path
|
||||
from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub
|
||||
|
||||
gitHubNamespace = "pyTooling"
|
||||
packageName = "pyDummy"
|
||||
packageDirectory = packageName
|
||||
packageInformationFile = Path(f"{packageDirectory}/__init__.py")
|
||||
|
||||
setup(**DescribePythonPackageHostedOnGitHub(
|
||||
packageName=packageName,
|
||||
description="pyDummy is a test package to verify GitHub actions for Python projects.",
|
||||
gitHubNamespace=gitHubNamespace,
|
||||
unittestRequirementsFile=Path("tests/requirements.txt"),
|
||||
sourceFileWithVersion=packageInformationFile,
|
||||
dataFiles={
|
||||
packageName: ["py.typed"]
|
||||
}
|
||||
))
|
||||
13
tests/requirements.txt
Normal file
13
tests/requirements.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
-r ../requirements.txt
|
||||
|
||||
# Coverage collection
|
||||
Coverage >= 7.3
|
||||
|
||||
# Test Runner
|
||||
pytest >= 7.4.0
|
||||
pytest-cov >= 4.1.0
|
||||
|
||||
# Static Type Checking
|
||||
mypy >= 1.5.0
|
||||
typing_extensions >= 4.7.1
|
||||
lxml>=4.9
|
||||
40
tests/unit/Dummy.py
Normal file
40
tests/unit/Dummy.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# ==================================================================================================================== #
|
||||
# _____ _ _ _ _ _ #
|
||||
# _ __ _ |_ _|__ ___ | (_)_ __ __ _ / \ ___| |_(_) ___ _ __ ___ #
|
||||
# | '_ \| | | || |/ _ \ / _ \| | | '_ \ / _` | / _ \ / __| __| |/ _ \| '_ \/ __| #
|
||||
# | |_) | |_| || | (_) | (_) | | | | | | (_| |_ / ___ \ (__| |_| | (_) | | | \__ \ #
|
||||
# | .__/ \__, ||_|\___/ \___/|_|_|_| |_|\__, (_)_/ \_\___|\__|_|\___/|_| |_|___/ #
|
||||
# |_| |___/ |___/ #
|
||||
# ==================================================================================================================== #
|
||||
# Authors: #
|
||||
# Patrick Lehmann #
|
||||
# #
|
||||
# License: #
|
||||
# ==================================================================================================================== #
|
||||
# Copyright 2017-2023 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 #
|
||||
# ==================================================================================================================== #
|
||||
#
|
||||
from unittest import TestCase
|
||||
|
||||
from pyDummy import Application
|
||||
|
||||
|
||||
class Instantiation(TestCase):
|
||||
def test_Application(self):
|
||||
app = Application()
|
||||
|
||||
self.assertEqual(1, app.Value)
|
||||
116
tests/unit/Platform/__init__.py
Normal file
116
tests/unit/Platform/__init__.py
Normal file
@@ -0,0 +1,116 @@
|
||||
# ==================================================================================================================== #
|
||||
# _____ _ _ _ _ _ #
|
||||
# _ __ _ |_ _|__ ___ | (_)_ __ __ _ / \ ___| |_(_) ___ _ __ ___ #
|
||||
# | '_ \| | | || |/ _ \ / _ \| | | '_ \ / _` | / _ \ / __| __| |/ _ \| '_ \/ __| #
|
||||
# | |_) | |_| || | (_) | (_) | | | | | | (_| |_ / ___ \ (__| |_| | (_) | | | \__ \ #
|
||||
# | .__/ \__, ||_|\___/ \___/|_|_|_| |_|\__, (_)_/ \_\___|\__|_|\___/|_| |_|___/ #
|
||||
# |_| |___/ |___/ #
|
||||
# ==================================================================================================================== #
|
||||
# Authors: #
|
||||
# Patrick Lehmann #
|
||||
# #
|
||||
# License: #
|
||||
# ==================================================================================================================== #
|
||||
# Copyright 2017-2023 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 #
|
||||
# ==================================================================================================================== #
|
||||
#
|
||||
"""Unit tests for TBD."""
|
||||
from os import getenv as os_getenv
|
||||
from pytest import mark
|
||||
from unittest import TestCase
|
||||
|
||||
from pyTooling.Platform import Platform
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
print("ERROR: you called a testcase declaration file as an executable module.")
|
||||
print("Use: 'python -m unitest <testcase module>'")
|
||||
exit(1)
|
||||
|
||||
|
||||
class AnyPlatform(TestCase):
|
||||
expected = os_getenv("ENVIRONMENT_NAME", default="Windows (x86-64)")
|
||||
|
||||
@mark.skipif(os_getenv("ENVIRONMENT_NAME", "skip") == "skip", reason="Skipped when environment variable 'ENVIRONMENT_NAME' isn't set.")
|
||||
def test_PlatformString(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Linux (x86-64)" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_NativeLinux' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_NativeLinux(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("MacOS (x86-64)" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_NativeMacOS' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_NativeMacOS(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Windows (x86-64)" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_NativeWindows' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_NativeWindows(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Windows+MSYS2 (x86-64) - MSYS" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_MSYS' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_MSYS(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Windows+MSYS2 (x86-64) - MinGW32" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_MinGW32' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_MinGW32(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Windows+MSYS2 (x86-64) - MinGW64" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_MinGW64' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_MinGW64(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Windows+MSYS2 (x86-64) - UCRT64" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_UCRT64' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_UCRT64(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Windows+MSYS2 (x86-64) - Clang32" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_Clang32' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_Clang32(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
|
||||
@mark.skipif("Windows+MSYS2 (x86-64) - Clang64" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_Clang64' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
|
||||
def test_Clang64(self) -> None:
|
||||
platform = Platform()
|
||||
|
||||
print()
|
||||
print(platform)
|
||||
31
tests/unit/__init__.py
Normal file
31
tests/unit/__init__.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# ==================================================================================================================== #
|
||||
# _____ _ _ _ _ _ #
|
||||
# _ __ _ |_ _|__ ___ | (_)_ __ __ _ / \ ___| |_(_) ___ _ __ ___ #
|
||||
# | '_ \| | | || |/ _ \ / _ \| | | '_ \ / _` | / _ \ / __| __| |/ _ \| '_ \/ __| #
|
||||
# | |_) | |_| || | (_) | (_) | | | | | | (_| |_ / ___ \ (__| |_| | (_) | | | \__ \ #
|
||||
# | .__/ \__, ||_|\___/ \___/|_|_|_| |_|\__, (_)_/ \_\___|\__|_|\___/|_| |_|___/ #
|
||||
# |_| |___/ |___/ #
|
||||
# ==================================================================================================================== #
|
||||
# Authors: #
|
||||
# Patrick Lehmann #
|
||||
# #
|
||||
# License: #
|
||||
# ==================================================================================================================== #
|
||||
# Copyright 2017-2023 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 #
|
||||
# ==================================================================================================================== #
|
||||
#
|
||||
"""Test code for pyTooling."""
|
||||
1
tests/unit/requirements.txt
Normal file
1
tests/unit/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
-r ../requirements.txt
|
||||
Reference in New Issue
Block a user