Skip to content

Commit

Permalink
Updated GitHub Actions workflow pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jan 20, 2024
1 parent 8060cb3 commit a0ddc2c
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 123 deletions.
245 changes: 131 additions & 114 deletions .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,164 +4,181 @@ on:
push:
workflow_dispatch:
schedule:
- cron: '0 0 * * 5'
# Every Friday at 22:00 - rerun pipeline to check for dependency-based issues
- cron: '0 22 * * 5'

jobs:

Params:
UnitTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@r1
with:
name: pyVHDLModel
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@r1
needs:
- Params
- UnitTestingParams
with:
jobs: ${{ needs.Params.outputs.python_jobs }}
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }}
jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }}
requirements: "-r tests/unit/requirements.txt"
pacboy: "msys/git"
unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}
coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}

Coverage:
uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@r1
StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r1
needs:
- Params
- UnitTestingParams
with:
python_version: ${{ needs.Params.outputs.python_version }}
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }}
secrets:
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
commands: |
mypy --html-report htmlmypy -p pyVHDLModel
html_report: 'htmlmypy'
html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}

DocCoverage:
uses: pyTooling/Actions/.github/workflows/CheckDocumentation.yml@r1
needs:
- UnitTestingParams
with:
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
directory: pyVHDLModel
# fail_below: 70

StaticTypeCheck:
uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r1
Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@r1
needs:
- Params
- UnitTestingParams
- UnitTesting
with:
python_version: ${{ needs.Params.outputs.python_version }}
requirements: '-r tests/requirements.txt'
commands: mypy --html-report htmlmypy -p pyVHDLModel
html_artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }}
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}

PublishCoverageResults:
uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@r1
needs:
- UnitTestingParams
- UnitTesting
with:
# coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}
# coverage_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }}
coverage_json_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }}
coverage_html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }}
secrets:
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}

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

Package:
uses: pyTooling/Actions/.github/workflows/Package.yml@r1
IntermediateCleanUp:
uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@r1
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@r1
# needs:
# - UnitTestingParams
# with:
# python_version: ${{ needs.UnitTestingParams.outputs.python_version }}

HTMLDocumentation:
uses: pyTooling/Actions/.github/workflows/SphinxDocumentation.yml@r1
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@r1
needs:
- UnitTestingParams
- HTMLDocumentation
with:
document: pyVHDLModel
latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }}
pdf_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_pdf }}

PublishToGitHubPages:
uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@r1
needs:
- Params
- Coverage
- UnitTestingParams
- HTMLDocumentation
# - PDFDocumentation
- PublishCoverageResults
- StaticTypeCheck
with:
python_version: ${{ needs.Params.outputs.python_version }}
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }}
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 }}

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

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

VerifyDocs:
needs:
- Params
name: 👍 Verify example snippets using Python ${{ needs.Params.outputs.python_version }}
runs-on: ubuntu-latest

steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v3

- name: ⚙ Setup GHDL
uses: ghdl/setup-ghdl-ci@master

- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
# python-version: ${{ needs.Params.outputs.python_version }}

- name: 🐍 Install dependencies
run: |
pip3 install --disable-pip-version-check git+https://github.com/ghdl/ghdl.git@$(ghdl version hash)
- name: ✂ Extract code snippet from README
shell: python
run: |
from pathlib import Path
import re
ROOT = Path('.')
with (ROOT / 'README.md').open('r') as rptr:
content = rptr.read()
m = re.search(r"```py(thon)?(?P<code>.*?)```", content, re.MULTILINE|re.DOTALL)
if m is None:
raise Exception("Regular expression did not find the example in the README!")
with (ROOT / 'tests/docs/example.py').open('w') as wptr:
wptr.write(m["code"])
# - name: Print example.py
# run: cat tests/docs/example.py

- name: ☑ Run example snippet
working-directory: tests/docs
run: |
python3 example.py
BuildTheDocs:
uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@r1
needs:
- Params
- VerifyDocs
with:
artifact: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }}

PublishToGitHubPages:
uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@r1
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@r1
needs:
- Params
- UnitTestingParams
- UnitTesting
- Coverage
- StaticTypeCheck
- BuildTheDocs
- PublishToGitHubPages
- HTMLDocumentation
- PDFDocumentation
- PublishTestResults
- PublishCoverageResults
- PublishToGitHubPages
# - PublishOnPyPI
with:
package: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }}
package: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
remaining: |
${{ fromJson(needs.Params.outputs.artifact_names).unittesting_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 }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}-*
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_html }}-*
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}-*
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }}-*
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }}-*
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }}-*
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_html }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }}
${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }}
# ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_pdf }}
36 changes: 27 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools >= 68.0.0",
"setuptools >= 69.0.0",
"wheel >= 0.40.0",
"pyTooling ~= 6.0"
]
Expand All @@ -10,12 +10,14 @@ build-backend = "setuptools.build_meta"
line-length = 120

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

files = ["pyVHDLModel"]
python_version = "3.12"
#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]
Expand All @@ -27,13 +29,26 @@ filterwarnings = [
"error::DeprecationWarning",
"error::PendingDeprecationWarning"
]
junit_logging = "all"

[tool.interrogate]
color = true
verbose = 1 # possible values: 0 (minimal output), 1 (-v), 2 (-vv)
fail-under = 80
#generate-badge = "."
#badge-format = "png"
ignore-setters = true

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

[tool.coverage.report]
Expand All @@ -47,9 +62,12 @@ 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 pyVHDLModel"

[tool.coverage.xml]
output = "report/coverage/coverage.xml"
1 change: 1 addition & 0 deletions tests/unit/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r ../requirements.txt

0 comments on commit a0ddc2c

Please sign in to comment.