Check that each supported board is mentioned in README.md

This commit is contained in:
Maxim Reznik 2023-12-01 14:22:14 +02:00
parent 22ae2aea53
commit 503ec28492
2 changed files with 38 additions and 0 deletions

View File

@ -32,6 +32,7 @@ jobs:
- run: python3 $PWD/scripts/build_all_examples.py
- run: python3 $PWD/testsuite/run.py
- run: python3 $PWD/scripts/check_readme.py
win-build:
name: Build and test on Windows

37
scripts/check_readme.py Executable file
View File

@ -0,0 +1,37 @@
#! /usr/bin/env python3
import os
import sys
import config
import config.user_input.console
from build_all_examples import run_program
from config.boards import list_of_boards
script_dir = os.path.dirname(__file__)
ADL_root_dir = os.path.abspath(os.path.join(script_dir, ".."))
top_readme_file = os.path.join(ADL_root_dir, "README.md")
undocumented = []
error = \
"""Next boards were not mentioned in the top README.md file!
Please, append each of them to the table in the Board List section.
"""
with open(top_readme_file, 'r', encoding='utf-8') as file:
lines = [line for line in file]
# No error on Custom_Board:
lines.append("[Custom_Board]")
for board in list_of_boards():
text = f"[{board}]"
found = [line for line in lines if text in line]
if not found:
undocumented.append(board)
if undocumented:
print(error)
print(undocumented)
sys.exit(1)