Skip to content

Commit fe9bc9e

Browse files
salkiniumchris-durand
authored andcommitted
[ci] Always upload all HAL job logs
1 parent af7b15e commit fe9bc9e

File tree

4 files changed

+44
-14
lines changed

4 files changed

+44
-14
lines changed

.github/workflows/compile-all.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
run: |
2121
(cd test/all && python3 run_all.py at --quick-remaining)
2222
- name: Upload log artifacts
23+
if: always()
2324
uses: actions/upload-artifact@v2
2425
with:
2526
name: avr-compile-all
@@ -40,6 +41,7 @@ jobs:
4041
run: |
4142
(cd test/all && python3 run_all.py samd --quick-remaining)
4243
- name: Upload log artifacts
44+
if: always()
4345
uses: actions/upload-artifact@v2
4446
with:
4547
name: samd-compile-all
@@ -60,6 +62,7 @@ jobs:
6062
run: |
6163
(cd test/all && python3 run_all.py stm32f0 --quick-remaining)
6264
- name: Upload log artifacts
65+
if: always()
6366
uses: actions/upload-artifact@v2
6467
with:
6568
name: stm32f0-compile-all
@@ -80,6 +83,7 @@ jobs:
8083
run: |
8184
(cd test/all && python3 run_all.py stm32f1 --quick-remaining)
8285
- name: Upload log artifacts
86+
if: always()
8387
uses: actions/upload-artifact@v2
8488
with:
8589
name: stm32f1-compile-all
@@ -100,6 +104,7 @@ jobs:
100104
run: |
101105
(cd test/all && python3 run_all.py stm32f2 --quick-remaining)
102106
- name: Upload log artifacts
107+
if: always()
103108
uses: actions/upload-artifact@v2
104109
with:
105110
name: stm32f2-compile-all
@@ -120,6 +125,7 @@ jobs:
120125
run: |
121126
(cd test/all && python3 run_all.py stm32f3 --quick-remaining)
122127
- name: Upload log artifacts
128+
if: always()
123129
uses: actions/upload-artifact@v2
124130
with:
125131
name: stm32f3-compile-all
@@ -140,6 +146,7 @@ jobs:
140146
run: |
141147
(cd test/all && python3 run_all.py stm32f4 --quick-remaining --split 3 --part 0)
142148
- name: Upload log artifacts
149+
if: always()
143150
uses: actions/upload-artifact@v2
144151
with:
145152
name: stm32f4-compile-all-1
@@ -160,6 +167,7 @@ jobs:
160167
run: |
161168
(cd test/all && python3 run_all.py stm32f4 --quick-remaining --split 3 --part 1)
162169
- name: Upload log artifacts
170+
if: always()
163171
uses: actions/upload-artifact@v2
164172
with:
165173
name: stm32f4-compile-all-2
@@ -180,6 +188,7 @@ jobs:
180188
run: |
181189
(cd test/all && python3 run_all.py stm32f4 --quick-remaining --split 3 --part 2)
182190
- name: Upload log artifacts
191+
if: always()
183192
uses: actions/upload-artifact@v2
184193
with:
185194
name: stm32f4-compile-all-3
@@ -200,6 +209,7 @@ jobs:
200209
run: |
201210
(cd test/all && python3 run_all.py stm32f7 --quick-remaining --split 2 --part 0)
202211
- name: Upload log artifacts
212+
if: always()
203213
uses: actions/upload-artifact@v2
204214
with:
205215
name: stm32f7-compile-all-1
@@ -220,6 +230,7 @@ jobs:
220230
run: |
221231
(cd test/all && python3 run_all.py stm32f7 --quick-remaining --split 2 --part 1)
222232
- name: Upload log artifacts
233+
if: always()
223234
uses: actions/upload-artifact@v2
224235
with:
225236
name: stm32f7-compile-all-2
@@ -240,6 +251,7 @@ jobs:
240251
run: |
241252
(cd test/all && python3 run_all.py stm32l0 --quick-remaining --split 2 --part 0)
242253
- name: Upload log artifacts
254+
if: always()
243255
uses: actions/upload-artifact@v2
244256
with:
245257
name: stm32l0-compile-all-1
@@ -260,6 +272,7 @@ jobs:
260272
run: |
261273
(cd test/all && python3 run_all.py stm32l0 --quick-remaining --split 2 --part 1)
262274
- name: Upload log artifacts
275+
if: always()
263276
uses: actions/upload-artifact@v2
264277
with:
265278
name: stm32l0-compile-all-2
@@ -281,6 +294,7 @@ jobs:
281294
run: |
282295
(cd test/all && python3 run_all.py stm32l1 --quick-remaining)
283296
- name: Upload log artifacts
297+
if: always()
284298
uses: actions/upload-artifact@v2
285299
with:
286300
name: stm32l1-compile-all
@@ -301,6 +315,7 @@ jobs:
301315
run: |
302316
(cd test/all && python3 run_all.py stm32l4 --quick-remaining --split 3 --part 0)
303317
- name: Upload log artifacts
318+
if: always()
304319
uses: actions/upload-artifact@v2
305320
with:
306321
name: stm32l4-compile-all-1
@@ -321,6 +336,7 @@ jobs:
321336
run: |
322337
(cd test/all && python3 run_all.py stm32l4 --quick-remaining --split 3 --part 1)
323338
- name: Upload log artifacts
339+
if: always()
324340
uses: actions/upload-artifact@v2
325341
with:
326342
name: stm32l4-compile-all-2
@@ -341,6 +357,7 @@ jobs:
341357
run: |
342358
(cd test/all && python3 run_all.py stm32l4 --quick-remaining --split 3 --part 2)
343359
- name: Upload log artifacts
360+
if: always()
344361
uses: actions/upload-artifact@v2
345362
with:
346363
name: stm32l4-compile-all-3
@@ -361,6 +378,7 @@ jobs:
361378
run: |
362379
(cd test/all && python3 run_all.py stm32g0 --quick-remaining)
363380
- name: Upload log artifacts
381+
if: always()
364382
uses: actions/upload-artifact@v2
365383
with:
366384
name: stm32g0-compile-all
@@ -381,6 +399,7 @@ jobs:
381399
run: |
382400
(cd test/all && python3 run_all.py stm32g4 --quick-remaining --split 2 --part 0)
383401
- name: Upload log artifacts
402+
if: always()
384403
uses: actions/upload-artifact@v2
385404
with:
386405
name: stm32g4-compile-all-1
@@ -401,6 +420,7 @@ jobs:
401420
run: |
402421
(cd test/all && python3 run_all.py stm32g4 --quick-remaining --split 2 --part 1)
403422
- name: Upload log artifacts
423+
if: always()
404424
uses: actions/upload-artifact@v2
405425
with:
406426
name: stm32g4-compile-all-2

.github/workflows/linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ jobs:
6767
run: |
6868
python3 tools/scripts/synchronize_docs.py -d
6969
git checkout .
70+
python3 tools/scripts/generate_hal_matrix.py -d
71+
git checkout .
7072
- name: Check Examples
7173
if: always()
7274
run: |

tools/scripts/generate_hal_matrix.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
1010
# -----------------------------------------------------------------------------
1111

12-
import lbuild, re, functools
12+
import lbuild, re, functools, sys, subprocess
1313
from collections import defaultdict
1414
from jinja2 import Environment
1515
from pathlib import Path
@@ -209,9 +209,23 @@ def hal_format_tables():
209209

210210
return tables
211211

212-
# if __name__ == "__main__":
213-
# output = hal_format_tables()
214-
# print(output["avr"])
215-
# print(output["stm32_all"])
216-
# print(output["stm32"])
217-
# print(output["sam"])
212+
213+
hal_tables = hal_format_tables()
214+
readme = repopath("README.md")
215+
readme.write_text(re.sub(
216+
r"<!--alltable-->.*?<!--/alltable-->",
217+
"<!--alltable-->{}<!--/alltable-->".format(hal_tables["all"]),
218+
readme.read_text(), flags=re.DOTALL | re.MULTILINE))
219+
220+
# Check git differences and fail
221+
if "-d" in sys.argv:
222+
differences = subprocess.run("git diff", shell=True, cwd=repopath("."),
223+
stdout=subprocess.PIPE).stdout.decode("utf-8").strip(" \n")
224+
if len(differences):
225+
subprocess.run("git --no-pager diff", shell=True, cwd=repopath("."))
226+
print("\nPlease synchronize the HAL implementation table:\n\n"
227+
" $ python3 tools/scripts/generate_hal_matrix.py\n\n"
228+
"and then commit the results!")
229+
exit(1)
230+
231+
exit(0)

tools/scripts/synchronize_docs.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
2929
"""
3030

31-
def repopath(path):
32-
return (Path(os.path.abspath(__file__)).parents[2] / path)
33-
34-
with open(repopath("tools/scripts/generate_hal_matrix.py")) as hal_tables:
35-
exec(hal_tables.read())
31+
repopath = lambda path: Path(__file__).parents[2] / path
3632

3733
def run(where, command, stdin=None):
3834
print(command)
@@ -152,15 +148,13 @@ def get_lbuild(root, target=None):
152148
driver_table = format_table(drivers, 6)
153149

154150
# Read the repo README.md and replace these keys
155-
hal_tables = hal_format_tables()
156151
readme = readme_path.read_text()
157152
readme = replace(readme, "authorcount", author_count - 7)
158153
readme = replace(readme, "avrcount", avr_count)
159154
readme = replace(readme, "samcount", sam_count)
160155
readme = replace(readme, "stmcount", stm_count)
161156
readme = replace(readme, "allcount", all_count)
162157
readme = replace(readme, "bsptable", bsp_table)
163-
readme = replace(readme, "alltable", hal_tables["all"])
164158
readme = replace(readme, "drivertable", driver_table)
165159
readme_path.write_text(readme)
166160

0 commit comments

Comments
 (0)