Skip to content

Commit 5c96a31

Browse files
committed
[ci] Add KG update action
1 parent e056c55 commit 5c96a31

File tree

2 files changed

+225
-0
lines changed

2 files changed

+225
-0
lines changed

.github/workflows/test-kg.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Test Generate Knowledge Graphs
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
test-kg-stmicro:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
family_group:
14+
- name: 'A'
15+
families: [STM32L1, STM32L4, STM32U0]
16+
- name: 'B'
17+
families: [STM32F0, STM32F4, STM32H5, STM32WL]
18+
- name: 'C'
19+
families: [STM32G4, STM32F7]
20+
- name: 'D'
21+
families: [STM32G0, STM32L0, STM32U5]
22+
- name: 'E'
23+
families: [STM32C0, STM32F1, STM32F2, STM32F3, STM32L5, STM32U3, STM32WB]
24+
- name: 'F'
25+
families: [STM32H7]
26+
27+
name: Update KG ${{ matrix.family_group.name }}
28+
29+
steps:
30+
- name: Check out Repository
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Python 3.12
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: "3.12"
37+
38+
- name: Install Python Dependencies
39+
run: |
40+
pip3 install -r tools/requirements.txt -e .
41+
42+
- name: Clone STMicro CubeMX Archive
43+
uses: actions/checkout@v4
44+
with:
45+
repository: modm-ext/archive-stmicro-cubemx
46+
path: ext/stmicro/cubemx
47+
ssh-key: ${{ secrets.SSH_KEY_STMICRO_CUBEMX }}
48+
49+
- name: Clone STMicro Sources
50+
run: |
51+
make ext/arm/cmsis/ ext/stmicro/cubehal/ ext/stmicro/header/
52+
53+
- name: Generate Database for Family Group ${{ matrix.family_group.name }}
54+
run: |
55+
FAMILY_LIST='${{ toJson(matrix.family_group.families) }}'
56+
OVERALL_STATUS=0
57+
set +e
58+
59+
for FAMILY in $(echo "$FAMILY_LIST" | jq -r '.[]')
60+
do
61+
echo "::group::Generating database for $FAMILY"
62+
63+
python3 -m modm_data.cube2kg --family $FAMILY
64+
if [ $? -ne 0 ]; then
65+
echo "::error::Database generation for $FAMILY FAILED."
66+
OVERALL_STATUS=1
67+
fi
68+
69+
echo "::endgroup::"
70+
done
71+
72+
exit $OVERALL_STATUS
73+
74+
- name: Upload KG Logs
75+
if: always()
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: logs-${{ matrix.family_group.name }}
79+
path: log/stmicro/kg
80+
81+
- name: Upload KGs
82+
if: always()
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: kg-${{ matrix.family_group.name }}
86+
path: ext/stmicro/kg-archive
87+
88+
# C0 0m33
89+
90+
# F0 0m45
91+
# F1 1m20
92+
# F2 0m46
93+
# F3 1m07
94+
# F4 3m23
95+
# F7 2m29
96+
97+
# G0 1m53
98+
# G4 3m12
99+
100+
# H5 1m26
101+
# H7 5m23
102+
103+
# L0 1m19
104+
# L1 1m32
105+
# L4 3m49
106+
# L5 0m53
107+
108+
# U0 0m32
109+
# U3 0m47
110+
# U5 2m16
111+
112+
# WB 0m31
113+
# WL 0m15
114+
115+

.github/workflows/update-kg.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Update Knowledge Graphs
2+
3+
on:
4+
schedule:
5+
- cron: "37 10 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-kg-stmicro:
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: Check out Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Configure Git
17+
run: |
18+
git config --global user.email "[email protected]"
19+
git config --global user.name "modm update bot"
20+
21+
22+
- name: Setup Python 3.12
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install Python Dependencies
28+
run: |
29+
pip3 install -r tools/requirements.txt -e .
30+
31+
32+
# This cache repository is private since copyright prevents republishing!
33+
# Nicely ask @salkinium for access to this repository.
34+
- name: Clone STMicro CubeMX Archive
35+
uses: actions/checkout@v4
36+
with:
37+
repository: modm-ext/archive-stmicro-cubemx
38+
path: ext/stmicro/cubemx
39+
ssh-key: ${{ secrets.SSH_KEY_STMICRO_CUBEMX }}
40+
41+
- name: Clone STMicro KG Archive
42+
uses: actions/checkout@v4
43+
with:
44+
repository: modm-ext/archive-stmicro-kg
45+
path: ext/stmicro/kg-archive
46+
ssh-key: ${{ secrets.SSH_KEY_STMICRO_KG }}
47+
persist-credentials: true
48+
49+
- name: Clone STMicro Sources
50+
run: |
51+
make ext/arm/cmsis/ ext/stmicro/cubehal/ ext/stmicro/header/ ext/stmicro/svd/
52+
53+
- name: Generate STM32Cx Database
54+
run: |
55+
python3 -m modm_data.cube2kg --family STM32C0
56+
57+
- name: Generate STM32Fx Database
58+
if: always()
59+
run: |
60+
python3 -m modm_data.cube2kg --family STM32F0
61+
python3 -m modm_data.cube2kg --family STM32F1
62+
python3 -m modm_data.cube2kg --family STM32F2
63+
python3 -m modm_data.cube2kg --family STM32F3
64+
python3 -m modm_data.cube2kg --family STM32F4
65+
python3 -m modm_data.cube2kg --family STM32F7
66+
67+
- name: Generate STM32Gx Database
68+
if: always()
69+
run: |
70+
python3 -m modm_data.cube2kg --family STM32G0
71+
python3 -m modm_data.cube2kg --family STM32G4
72+
73+
- name: Generate STM32Hx Database
74+
if: always()
75+
run: |
76+
python3 -m modm_data.cube2kg --family STM32H5
77+
python3 -m modm_data.cube2kg --family STM32H7
78+
79+
- name: Generate STM32Lx Database
80+
if: always()
81+
run: |
82+
python3 -m modm_data.cube2kg --family STM32L0
83+
python3 -m modm_data.cube2kg --family STM32L1
84+
python3 -m modm_data.cube2kg --family STM32L4
85+
python3 -m modm_data.cube2kg --family STM32L5
86+
87+
- name: Generate STM32Ux Database
88+
if: always()
89+
run: |
90+
python3 -m modm_data.cube2kg --family STM32U0
91+
python3 -m modm_data.cube2kg --family STM32U3
92+
python3 -m modm_data.cube2kg --family STM32U5
93+
94+
- name: Generate STM32Wx Database
95+
if: always()
96+
run: |
97+
python3 -m modm_data.cube2kg --family STM32WB
98+
python3 -m modm_data.cube2kg --family STM32WL
99+
100+
- name: Git push KG Archive
101+
working-directory: ext/stmicro/kg-archive
102+
run: |
103+
git add .
104+
git commit -m "Update KGs" || true
105+
git gc
106+
git count-objects -vH
107+
git push origin main
108+
109+
110+

0 commit comments

Comments
 (0)