summaryrefslogtreecommitdiff
path: root/tools/ci_new_boards_check.py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2019-08-15 00:07:29 -0700
committerScott Shawcroft <scott@tannewt.org>2019-08-27 19:53:54 -0700
commit6106909c1094b39980dd6f94ca17782681f3be9a (patch)
tree1b85ecf7fee4915e8a8ff6abb78141f294b2f458 /tools/ci_new_boards_check.py
parent7cbae3d20c0f79511a932bbcb2d66d2620b6bb3a (diff)
Swap the CI to GitHub Actions from Travis
Diffstat (limited to 'tools/ci_new_boards_check.py')
-rw-r--r--tools/ci_new_boards_check.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/tools/ci_new_boards_check.py b/tools/ci_new_boards_check.py
new file mode 100644
index 000000000..7ad8af842
--- /dev/null
+++ b/tools/ci_new_boards_check.py
@@ -0,0 +1,50 @@
+#! /usr/bin/env python3
+
+import sys
+import os
+import json
+import yaml
+
+import build_board_info
+
+workflow_file = '.github/workflows/build.yml'
+
+# Get boards in json format
+boards_info_json = build_board_info.get_board_mapping()
+
+# Get all the boards out of the json format
+info_boards = [board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False)]
+
+# We need to know the path of the workflow file
+base_path = os.path.dirname(__file__)
+yml_path = os.path.abspath(os.path.join(base_path, '..', workflow_file))
+
+# Loading board list based on build jobs in the workflow file.
+ci_boards = []
+with open(yml_path, "r") as f:
+ workflow = yaml.safe_load(f)
+
+ok = True
+for job in workflow["jobs"]:
+ if not job.startswith("build"):
+ continue
+ job_boards = workflow["jobs"][job]["strategy"]["matrix"]["board"]
+ if job_boards != sorted(job_boards):
+ print("Boards for job \"{}\" not sorted. Must be:".format(job))
+ print(" - \"" + "\"\n - \"".join(sorted(job_boards)) + "\"")
+ ok = False
+ ci_boards.extend(job_boards)
+
+# All the travis_boards elements must be on info_boards
+info_boards.sort()
+ci_boards.sort()
+
+missing_boards = set(info_boards) - set(ci_boards)
+
+if missing_boards:
+ print('Boards missing in {}:'.format(workflow_file))
+ for board in missing_boards:
+ print(board)
+
+if not ok:
+ sys.exit(1)