Skip to content
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
16 changes: 9 additions & 7 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Build and deploy docs
name: Build docs

on:
push:
branches:
- main
- main-**
pull_request:

jobs:
build-upload-docs:
Expand All @@ -13,12 +14,6 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Configure Git
run: |
git config --global user.email "bot@modm.io"
git config --global user.name "modm update bot"


- name: Setup Python 3.12
uses: actions/setup-python@v4
with:
Expand All @@ -28,19 +23,26 @@ jobs:
run: |
pip3 install -r tools/requirements.txt ".[docs]"


- name: Clone modm-ext/data.modm.io repository
if: startsWith(github.ref, 'refs/heads/main')
uses: actions/checkout@v4
with:
repository: modm-ext/data.modm.io
ssh-key: ${{secrets.SSH_KEY_DATA_MODM_IO}}
path: docs/data.modm.io


- name: Build Homepage
run: |
make build-homepage


- name: Push New Docs to Github
if: startsWith(github.ref, 'refs/heads/main')
run: |
git config --global user.email "bot@modm.io"
git config --global user.name "modm update bot"
cd docs/data.modm.io
git add -A
git diff-index --quiet HEAD || git commit -m "Update"
Expand Down
56 changes: 52 additions & 4 deletions .github/workflows/test-kg.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: Test Generate Knowledge Graphs
name: Generate Knowledge Graphs

on:
workflow_dispatch:
pull_request:
release:
types: [published]

jobs:
test-kg-stmicro:
generate-kg-stmicro:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.family_group.name }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
strategy:
fail-fast: false
matrix:
Expand All @@ -25,7 +30,6 @@ jobs:
families: [STM32H7]

name: Update KG ${{ matrix.family_group.name }}

steps:
- name: Check out Repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -77,12 +81,56 @@ jobs:
with:
name: logs-${{ matrix.family_group.name }}
path: log/stmicro/kg
retention-days: 7
retention-days: 1

- name: Upload KGs
if: always()
uses: actions/upload-artifact@v4
with:
name: kg-${{ matrix.family_group.name }}
path: ext/stmicro/kg-archive
retention-days: 1


merge-kg-artifacts:
name: Merge all KGs into one Artifact
runs-on: ubuntu-latest
needs: generate-kg-stmicro
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-merge-kg-artifacts
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: Check out Repository
uses: actions/checkout@v4
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}

- name: Download All KGs
uses: actions/download-artifact@v4
with:
pattern: kg-*
path: kg-archive-all

- name: Merge all KGs
run: |
mkdir -p kg-archive/

find kg-archive-all/ -mindepth 2 -maxdepth 2 -type d | while read DIR; do
cp -r "$DIR" kg-archive/
done

- name: Upload Final Knowledge Graphs
uses: actions/upload-artifact@v4
with:
name: kg-archive
path: kg-archive/
retention-days: 7

- name: Upload to Github Release
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
with:
files: |
kg-archive/
CHANGELOG.md
README.md
LICENSE
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 0.0.2

- Update the regression tests and enforce it via CI.
- Factor out common pdf2html code from the STM32 specialization.
- Enforce code style using Ruff in the CI.
- Update dependencies and frozen requirements.txt.
- Add downloader code for CubeProg database.
- Import latest changes from modm-devices for new STM32 devices.
- Replace OWLready with Kuzu KG implementation for storing all data.
- Publish KG database as artifact to GitHub releases.


## 0.0.1

Import from [the JSys paper artifact](https://github.com/salkinium/pdf-data-extraction-jsys-artifact)
Expand Down
1 change: 0 additions & 1 deletion src/modm_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
__version__ = "0.0.1"

__all__ = [
"cube2owl",
"cubehal",
"cubemx",
"dl",
Expand Down
16 changes: 2 additions & 14 deletions src/modm_data/cubemx/device_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,7 @@ def _family_file() -> XmlReader:

# ============================= MULTIPLE DEVICES ==============================
def _format_raw_devices(rawDevices):
TemperatureMap = {0: "6", 105: "7", 125: "3"}
devices = set()
for dev in rawDevices:
temp_max = dev.find("Temperature")
temp_max = "" if temp_max is None else temp_max.get("Max")
name = dev.get("RefName")
temp_max = int(float(temp_max)) if len(temp_max) else min(TemperatureMap)
for temp, value in TemperatureMap.items():
if temp_max >= temp:
devices.add(name[:12] + value + name[13:])
return sorted(list(devices))
return list(sorted(set(d.get("RefName") for d in rawDevices)))


def devices_from_family(family: str) -> list[str]:
Expand Down Expand Up @@ -87,9 +77,7 @@ def devices_from_partname(partname: str) -> list[dict[str]]:
:param partname: A full STM32 device name.
:return: a list of dictionaries containing a device specific data structure.
"""
deviceNames = _family_file().query(
f'//Family/SubFamily/Mcu[starts-with(@RefName,"{partname[:12]}x{partname[13:]}")]'
)
deviceNames = _family_file().query(f'//Family/SubFamily/Mcu[starts-with(@RefName,"{partname}")]')
comboDeviceName = sorted([d.get("Name") for d in deviceNames])[0]
device_file = XmlReader(os.path.join(_MCU_PATH, comboDeviceName + ".xml"))
did = did_from_string(partname.lower())
Expand Down
Loading
Loading