Make it easier to locally test ci_set_matrix
Now you can e.g., `tools/ci_set_matrix.py ports/raspberrypi/mpconfigport.h` and see what outputs would be set.
This commit is contained in:
parent
81154b4ee6
commit
cab4063057
@ -80,12 +80,11 @@ This is the same list as in the preprocess_frozen_modules script."""
|
||||
repository_urls = {}
|
||||
"""Cache of repository URLs for frozen modules."""
|
||||
|
||||
root_dir = pathlib.Path(__file__).resolve().parent.parent
|
||||
|
||||
def get_circuitpython_root_dir():
|
||||
""" The path to the root './circuitpython' directory.
|
||||
"""
|
||||
file_path = pathlib.Path(__file__).resolve()
|
||||
root_dir = file_path.parent.parent
|
||||
|
||||
return root_dir
|
||||
|
||||
def get_shared_bindings():
|
||||
@ -102,7 +101,7 @@ def get_board_mapping():
|
||||
"""
|
||||
boards = {}
|
||||
for port in SUPPORTED_PORTS:
|
||||
board_path = os.path.join("../ports", port, "boards")
|
||||
board_path = root_dir / "ports" / port / "boards"
|
||||
for board_path in os.scandir(board_path):
|
||||
if board_path.is_dir():
|
||||
board_files = os.listdir(board_path.path)
|
||||
|
@ -19,6 +19,13 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import yaml
|
||||
import pathlib
|
||||
|
||||
tools_dir = pathlib.Path(__file__).resolve().parent
|
||||
top_dir = tools_dir.parent
|
||||
|
||||
sys.path.insert(0, str(tools_dir / "adabot"))
|
||||
sys.path.insert(0, str(top_dir / "docs"))
|
||||
|
||||
import build_board_info
|
||||
from shared_bindings_matrix import get_settings_from_makefile
|
||||
@ -40,12 +47,17 @@ IGNORE = [
|
||||
"tools/ci_check_duplicate_usb_vid_pid.py",
|
||||
]
|
||||
|
||||
changed_files = {}
|
||||
try:
|
||||
if len(sys.argv) > 1:
|
||||
print("Using files list on commandline")
|
||||
changed_files = sys.argv[1:]
|
||||
else:
|
||||
c = os.environ["CHANGED_FILES"]
|
||||
if c == "":
|
||||
print("CHANGED_FILES is in environment, but value is empty")
|
||||
changed_files = []
|
||||
else:
|
||||
print("Using files list in CHANGED_FILES")
|
||||
changed_files = json.loads(os.environ["CHANGED_FILES"])
|
||||
except json.decoder.JSONDecodeError as exc:
|
||||
if exc.msg != "Expecting value":
|
||||
raise
|
||||
|
||||
|
||||
def set_output(name, value):
|
||||
@ -53,7 +65,7 @@ def set_output(name, value):
|
||||
with open(os.environ["GITHUB_OUTPUT"], "at") as f:
|
||||
print(f"{name}={value}", file=f)
|
||||
else:
|
||||
print("Would set GitHub actions output {name} to '{value}'")
|
||||
print(f"Would set GitHub actions output {name} to '{value}'")
|
||||
|
||||
|
||||
def set_boards_to_build(build_all):
|
||||
@ -114,7 +126,7 @@ def set_boards_to_build(build_all):
|
||||
for board in all_board_ids:
|
||||
if board not in board_settings:
|
||||
board_settings[board] = get_settings_from_makefile(
|
||||
"../ports/" + board_to_port[board], board
|
||||
str(top_dir / "ports" / board_to_port[board]), board
|
||||
)
|
||||
settings = board_settings[board]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user