def set_boards_to_build(build_all): # Get boards in json format boards_info_json = build_board_info.get_board_mapping() all_board_ids = set() port_to_boards = {} board_to_port = {} for board_id in boards_info_json: info = boards_info_json[board_id] if info.get("alias", False): continue all_board_ids.add(board_id) port = info["port"] if port not in port_to_boards: port_to_boards[port] = set() port_to_boards[port].add(board_id) board_to_port[board_id] = port boards_to_build = all_board_ids if not build_all: boards_to_build = set() board_pattern = re.compile(r"^ports\/[^/]+\/boards\/([^/]+)\/") port_pattern = re.compile(r"^ports\/([^/]+)\/") for p in changed_files: # See if it is board specific board_matches = board_pattern.search(p) if board_matches: board = board_matches.group(1) boards_to_build.add(board) continue # See if it is port specific port_matches = port_pattern.search(p) if port_matches: port = port_matches.group(1) if port != "unix": boards_to_build.update(port_to_boards[port]) continue # Otherwise build it all boards_to_build = all_board_ids break # Split boards by architecture. print("Building boards:") arch_to_boards = {"aarch": [], "arm": [], "riscv": [], "espressif": []} for board in boards_to_build: print(" ", board) port = board_to_port.get(board) # A board can appear due to its _deletion_ (rare) # if this happens it's not in `board_to_port`. if not port: continue arch = PORT_TO_ARCH[port] arch_to_boards[arch].append(board) # Set the step outputs for each architecture for arch in arch_to_boards: print("::set-output name=boards-" + arch + "::" + json.dumps(sorted(arch_to_boards[arch])))
import os import sys import subprocess import shutil import build_board_info as build_info import time for port in build_info.SUPPORTED_PORTS: result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True) PARALLEL = "-j 5" if "GITHUB_ACTION" in os.environ: PARALLEL = "-j 2" all_boards = build_info.get_board_mapping() build_boards = list(all_boards.keys()) if "BOARDS" in os.environ: build_boards = os.environ["BOARDS"].split() sha, version = build_info.get_version_info() languages = build_info.get_languages() exit_status = 0 for board in build_boards: bin_directory = "../bin/{}/".format(board) os.makedirs(bin_directory, exist_ok=True) board_info = all_boards[board] for language in languages: bin_directory = "../bin/{board}/{language}".format(board=board,
#! /usr/bin/env python3 import sys import os import json import build_board_info # 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 .travis.yml file base_path = os.path.dirname(__file__) travis_path = os.path.abspath(os.path.join(base_path, '..', '.travis.yml')) # Loading board list based on TRAVIS_BOARDS env variable on .travis.yml travis_boards = [] with open(travis_path, 'r') as travis: # Get all lines that contain the substring 'TRAVIS_BOARDS' for line in travis: # Get the lines with TRAVIS_BOARDS= in it if line.find('TRAVIS_BOARDS=') is not -1: # Store all the boards names into travis_boards