enjoy-digital / litex_hw_ci

LiteX Hardware CI tests.
8 stars 0 forks source link

Develop a Python Build Script. #3

Closed enjoy-digital closed 7 months ago

enjoy-digital commented 8 months ago

Objective:

Create a Python script (build.py) that automates the building process for each configuration listed in the configurations.json file. The script should parse the JSON file, extract necessary details, and execute the build commands for each configuration.

Requirements:

Requires https://github.com/enjoy-digital/litex_hw_ci/issues/2.

Example Script Skeleton (build.py)

import json
import subprocess

# Load configurations
with open('configurations.json') as file:
    configurations = json.load(file)['configurations']

# Iterate and build each configuration
for config in configurations:
    try:
        subprocess.run(config['build_command'], shell=True, check=True)
    except subprocess.CalledProcessError as e:
        print(f"Build failed for {config['name']}: {e}")

Deliverables:

A Python script build.py that reads from configurations.json, executes build commands for each configuration, and handles any build errors.

Note: Efficiency and reliability are key in the build process. Ensure the script is well-structured, with clear error handling and reporting. This script is a critical component in automating and streamlining the build process for various hardware configurations.

enjoy-digital commented 7 months ago

This has now been prototyped. The base is here and will be refined as we use the test environment.