Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels authored Oct 17, 2021
2 parents 77fd434 + 9e2c78b commit 614445b
Show file tree
Hide file tree
Showing 41 changed files with 1,967 additions and 84 deletions.
142 changes: 121 additions & 21 deletions .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defaults:
shell: bash

jobs:

UnitTesting:
name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }}
runs-on: ubuntu-latest
Expand All @@ -15,10 +16,11 @@ jobs:
fail-fast: false
matrix:
include:
# - {python: 3.6, icon: 🔴}
- {python: 3.7, icon: 🟠}
- {python: 3.8, icon: 🟡}
- {python: 3.9, icon: 🟢}
# - {python: "3.6", icon: 🔴} # until 23.12.2021
- {python: "3.7", icon: 🟠} # until 27.06.2023
- {python: "3.8", icon: 🟡} # until Oct. 2024
- {python: "3.9", icon: 🟢} # until Oct. 2025
- {python: "3.10", icon: 🟢} # until Oct. 2026

env:
PYTHON: ${{ matrix.python }}
Expand All @@ -41,14 +43,14 @@ jobs:
- name: ☑ Run unit tests
run: |
python -m pytest -rA tests/unit
python -m pytest -rA tests/unit --color=yes
Coverage:
name: 📈 Collect Coverage Data using Python 3.9
name: 📈 Collect Coverage Data using Python 3.10
runs-on: ubuntu-latest

env:
PYTHON: 3.9
PYTHON: "3.10"
ARTIFACT: pyEDAA-ProjectModel-coverage-html
outputs:
python: ${{ env.PYTHON }}
Expand All @@ -71,7 +73,7 @@ jobs:
- name: Collect coverage
continue-on-error: true
run: |
python -m pytest -rA --cov=.. --cov-config=tests/.coveragerc tests/unit
python -m pytest -rA --cov=.. --cov-config=tests/.coveragerc tests/unit --color=yes
- name: Convert to cobertura format
run: |
Expand Down Expand Up @@ -106,11 +108,11 @@ jobs:
retention-days: 1

StaticTypeCheck:
name: 📈 Check Static Typing using Python 3.9
name: 👀 Check Static Typing using Python 3.10
runs-on: ubuntu-latest

env:
PYTHON: 3.9
PYTHON: "3.10"
ARTIFACT: pyEDAA-ProjectModel-typing-html
outputs:
python: ${{ env.PYTHON }}
Expand Down Expand Up @@ -282,12 +284,61 @@ jobs:
run: |
twine upload dist/*
VerifyDocs:
name: 👍 Verify example snippets using Python 3.10
runs-on: ubuntu-latest

env:
PYTHON: "3.10"
outputs:
python: ${{ env.PYTHON }}

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

- name: 🐍 Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON }}

- name: 🐍 Install dependencies
run: |
pip3 install .
- 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:
name: 📓 Run BuildTheDocs and publish to GH-Pages
name: 📓 Run BuildTheDocs
runs-on: ubuntu-latest
needs:
- VerifyDocs

# needs:
# - VerifyDocs
env:
ARTIFACT: pyEDAA-ProjectModel-documentation
outputs:
Expand All @@ -304,10 +355,10 @@ jobs:
RUN apk add -U --no-cache graphviz
EOF
- name: 🛳️ Build documentation using container edaa/doc and publish to GitHub Pages
- name: 🛳️ Build documentation using container edaa/doc
uses: buildthedocs/btd@v0
with:
token: ${{ github.token }}
skip-deploy: true

- name: 📤 Upload 'documentation' artifacts
uses: actions/upload-artifact@master
Expand All @@ -316,27 +367,76 @@ jobs:
path: doc/_build/html
retention-days: 7

ArtifactCleanUp:
name: 🗑️ Artifact Cleanup
PublishToGitHubPages:
name: 📚 Publish to GH-Pages
runs-on: ubuntu-latest

needs:
- BuildTheDocs
- Coverage
- StaticTypeCheck

env:
DOC: ${{ needs.BuildTheDocs.outputs.artifact }}
COVERAGE: ${{ needs.Coverage.outputs.artifact }}
TYPING: ${{ needs.StaticTypeCheck.outputs.artifact }}
outputs:
artifact: ${{ env.ARTIFACT }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: 📥 Download artifacts '${{ env.DOC }}' from 'StaticTypeCheck' job
uses: actions/download-artifact@v2
with:
name: ${{ env.DOC }}
path: public

- name: 📥 Download artifacts '${{ env.COVERAGE }}' from 'Coverage' job
uses: actions/download-artifact@v2
with:
name: ${{ env.COVERAGE }}
path: public/coverage

- name: 📥 Download artifacts '${{ env.TYPING }}' from 'StaticTypeCheck' job
uses: actions/download-artifact@v2
with:
name: ${{ env.TYPING }}
path: public/typing

- name: '📓 Publish site to GitHub Pages'
if: github.event_name != 'pull_request'
run: |
cd public
touch .nojekyll
git init
cp ../.git/config ./.git/config
git add .
git config --local user.email "BuildTheDocs@GitHubActions"
git config --local user.name "GitHub Actions"
git commit -a -m "update ${{ github.sha }}"
git push -u origin +HEAD:gh-pages
ArtifactCleanUp:
name: 🗑️ Artifact Cleanup
runs-on: ubuntu-latest
needs:
- Package
- PublishOnPyPI
- PublishToGitHubPages

env:
COVERAGE: ${{ needs.Coverage.outputs.artifact }}
TYPING: ${{ needs.StaticTypeCheck.outputs.artifact }}
PACKAGE: ${{ needs.Package.outputs.artifact }}
DOC: ${{ needs.BuildTheDocs.outputs.artifact }}

steps:
- name: 🗑️ Delete all Artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
${{ env.COVERAGE }}
${{ env.TYPING }}
${{ env.PACKAGE }}
# ${{ env.COVERAGE }}
# ${{ env.TYPING }}
${{ env.DOC }}
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[![Sourcecode on GitHub](https://img.shields.io/badge/edaa-org-pyEDAA.ProjectModel-323131.svg?logo=github&longCache=true)](https://github.com/edaa-org/pyEDAA.ProjectModel)
[![Sourcecode License](https://img.shields.io/pypi/l/pyEDAA.ProjectModel?logo=GitHub&label=code%20license)](LICENSE.md)
[![Sourcecode on GitHub](https://img.shields.io/badge/edaa--org-pyEDAA.ProjectModel-323131.svg?logo=github&longCache=true)](https://github.com/edaa-org/pyEDAA.ProjectModel)
[![Sourcecode License](https://img.shields.io/pypi/l/pyEDAA.ProjectModel?logo=Github&label=code%20license)](LICENSE.md)
[![GitHub tag (latest SemVer incl. pre-release)](https://img.shields.io/github/v/tag/edaa-org/pyEDAA.ProjectModel?logo=GitHub&include_prereleases)](https://github.com/edaa-org/pyEDAA.ProjectModel/tags)
[![GitHub release (latest SemVer incl. including pre-releases)](https://img.shields.io/github/v/release/edaa-org/pyEDAA.ProjectModel?logo=GitHub&include_prereleases)](https://github.com/edaa-org/pyEDAA.ProjectModel/releases/latest)
[![GitHub release date](https://img.shields.io/github/release-date/edaa-org/pyEDAA.ProjectModel?logo=GitHub&)](https://github.com/edaa-org/pyEDAA.ProjectModel/releases)
[![Dependent repos (via libraries.io)](https://img.shields.io/librariesio/dependent-repos/pypi/pyEDAA.ProjectModel?logo=GitHub)](https://github.com/edaa-org/pyEDAA.ProjectModel/network/dependents)
[![GitHub Workflow - Build and Test Status](https://img.shields.io/github/workflow/status/edaa-org/pyEDAA.ProjectModel/Test%20and%20Coverage?label=build%20and%20test&logo=GitHub%20Actions&logoColor=FFFFFF)](https://github.com/edaa-org/pyEDAA.ProjectModel/actions?query=workflow%3A%22Test+and+Coverage%22)
[![Codacy - Quality](https://img.shields.io/codacy/grade/2286426d2b11417e90010427b7fed8e7?logo=Codacy)](https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel)
[![Codacy - Coverage](https://img.shields.io/codacy/coverage/2286426d2b11417e90010427b7fed8e7?logo=Codacy)](https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel)
[![Codacy - Quality](https://img.shields.io/codacy/grade/c2635df20fa840bc85639ca2fa1d9cb4?logo=Codacy)](https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel)
[![Codacy - Coverage](https://img.shields.io/codacy/coverage/c2635df20fa840bc85639ca2fa1d9cb4?logo=Codacy)](https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel)
[![Codecov - Branch Coverage](https://img.shields.io/codecov/c/github/edaa-org/pyEDAA.ProjectModel?logo=Codecov)](https://codecov.io/gh/edaa-org/pyEDAA.ProjectModel)
[![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/pypi/pyEDAA.ProjectModel)](https://libraries.io/github/edaa-org/pyEDAA.ProjectModel/sourcerank)
[![GitHub Workflow Release Status](https://img.shields.io/github/workflow/status/edaa-org/pyEDAA.ProjectModel/Release?label=release&logo=GitHub%20Actions&logoColor=FFFFFF)](https://github.com/edaa-org/pyEDAA.ProjectModel/actions?query=workflow%3A%22Release%22)
Expand All @@ -31,19 +31,27 @@

## Examples


```python
from pathlib import Path
from pyEDAA.ProjectModel import Project, Design, FileSet, VHDLSourceFile

projectPath = Path("temp/project")
project = Project("project", rootDirectory=projectPath)
design = Design("design", project=project)
fileset = FileSet("uart", Path("src/uart"), design=design)
print(f"Current working directory: {Path.cwd()}")
projectDirectory = Path.cwd() / "../project"
print(f"Project directory: {projectDirectory!s} - {projectDirectory.exists()}")

project = Project("myProject", rootDirectory=projectDirectory)
designA = Design("designA", project=project, directory=Path("designA"))
designAFileset = FileSet("srcA", design=designA)
for vhdlFilePath in designAFileset.ResolvedPath.glob("*.vhdl"):
designAFileset.AddFile(VHDLSourceFile(vhdlFilePath))

libFileset = FileSet("lib", Path("../lib"), design=designA)
for vhdlFilePath in libFileset.ResolvedPath.glob("*.vhdl"):
libFileset.AddFile(VHDLSourceFile(vhdlFilePath))

for vhdlFilePath in fileset.ResolvedPath.glob("*.vhdl"):
vhdlFile = VHDLSourceFile(vhdlFilePath)
fileset.AddFile(vhdlFile)
print(f"All VHDL files in {designA.Name}:")
for file in designA.Files(fileType=VHDLSourceFile):
print(f" {file.Path}")
```


Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def _LatestTagName():
return check_output(["git", "describe", "--abbrev=0", "--tags"], universal_newlines=True).strip()

# The full version, including alpha/beta/rc tags
version = "0.1" # The short X.Y version.
release = "0.1.0" # The full version, including alpha/beta/rc tags.
version = "0.2" # The short X.Y version.
release = "0.2.0" # The full version, including alpha/beta/rc tags.
try:
if _IsUnderGitControl:
latestTagName = _LatestTagName()[1:] # remove prefix "v"
Expand Down
8 changes: 4 additions & 4 deletions doc/shields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@
:target: https://github.com/edaa-org/pyEDAA.ProjectModel/actions?query=workflow%3A%22Test+and+Coverage%22

.. # Codacy - quality
.. |SHIELD:svg:ProjectModel-codacy-quality| image:: https://img.shields.io/codacy/grade/2286426d2b11417e90010427b7fed8e7?logo=codacy
.. |SHIELD:svg:ProjectModel-codacy-quality| image:: https://img.shields.io/codacy/grade/c2635df20fa840bc85639ca2fa1d9cb4?logo=codacy
:alt: Codacy - Quality
:height: 22
:target: https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel
.. |SHIELD:png:ProjectModel-codacy-quality| image:: https://raster.shields.io/codacy/grade/2286426d2b11417e90010427b7fed8e7?logo=codacy
.. |SHIELD:png:ProjectModel-codacy-quality| image:: https://raster.shields.io/codacy/grade/c2635df20fa840bc85639ca2fa1d9cb4?logo=codacy
:alt: Codacy - Quality
:height: 22
:target: https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel

.. # Codacy - coverage
.. |SHIELD:svg:ProjectModel-codacy-coverage| image:: https://img.shields.io/codacy/coverage/2286426d2b11417e90010427b7fed8e7?logo=codacy
.. |SHIELD:svg:ProjectModel-codacy-coverage| image:: https://img.shields.io/codacy/coverage/c2635df20fa840bc85639ca2fa1d9cb4?logo=codacy
:alt: Codacy - Line Coverage
:height: 22
:target: https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel
.. |SHIELD:png:ProjectModel-codacy-coverage| image:: https://raster.shields.io/codacy/coverage/2286426d2b11417e90010427b7fed8e7?logo=codacy
.. |SHIELD:png:ProjectModel-codacy-coverage| image:: https://raster.shields.io/codacy/coverage/c2635df20fa840bc85639ca2fa1d9cb4?logo=codacy
:alt: Codacy - Line Coverage
:height: 22
:target: https://www.codacy.com/manual/edaa-org/pyEDAA.ProjectModel
Expand Down
Loading

0 comments on commit 614445b

Please sign in to comment.