diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f6a861b..a842fe34 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/scripts/check_readme.py b/scripts/check_readme.py new file mode 100755 index 00000000..d98d29a6 --- /dev/null +++ b/scripts/check_readme.py @@ -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)