Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add readme codeblock checks #182

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: ci

on: [push, pull_request]

env:
X_PYTHON_VERSION: "3.10"

jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,10 +49,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -62,6 +65,30 @@ jobs:
run: |
pycodestyle --count --max-line-length 120 basyx test

readme-codeblocks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.X_PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.X_PYTHON_VERSION }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pycodestyle mypy codeblocks
pip install -r requirements.txt
- name: Check typing with MyPy
run: |
mypy <(codeblocks python README.md)
- name: Check code style with PyCodestyle
run: |
codeblocks --wrap python README.md | pycodestyle --count --max-line-length 120 -
- name: Run readme codeblocks with Python
run: |
codeblocks python README.md | python

package:
runs-on: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ submodel.submodel_element.add(property)

Serialize the `Submodel` to XML:
```python
from basyx.aas.adapter import write_aas_xml_file
from basyx.aas.adapter.xml import write_aas_xml_file

data: model.DictObjectStore[model.Identifiable] = model.DictObjectStore()
data.add(submodel)
with open('Simple_Submodel.xml', 'w', encoding='utf-8') as f:
with open('Simple_Submodel.xml', 'wb') as f:
write_aas_xml_file(file=f, data=data)
```

Expand Down
Loading