apcountryman / prototype-kicad-project-ci-cd

KiCad project CI/CD prototype.
Other
0 stars 1 forks source link

Design traditional BOM generation CI job #19

Closed jaylamb closed 3 years ago

jaylamb commented 3 years ago

Feature Design Add traditional (spreadsheet style) bill of materials (BOM) generation CI script (ci/generate-traditional-bom) which will create a directory (bom) within the project repository, if it does not already exist. The directory should be the target for the KiBom KiBOM_CLI script's output. This output should be a basic HTML BOM, which can be modified using a configuration file, bom.ini, which is automatically generated the first time the script is run.

_Note: The script requires the BOM be available in the XML format. The KiAuto eeschema_do script's bom_xml function should be used to produce this._

Feature Use Case This CI job will run automatically as a part of pull requests, releases, etc... and will produce a simple bill of materials for all printed circuit boards contained within a project repository.

Detailed Design

local schematics; mapfile -t schematics < <( git -C "$repository" ls-files '*.sch' ':!:*-sheet-*.sch' | xargs -r -d '\n' -I '{}' find "$repository/{}" ); readonly schematics

for schematic in "${schematics[@]}"; do
    if ! "$repository/utilities/KiAuto/src/eeschema_do" bom_xml "$schematic" "$repository"; then
        abort
    fi  
done

local netlists; mapfile -t netlists < <( find *.xml ); readonly netlists

    for netlist in "${netlists[@]}"; do
        local bom_name=$( basename "$netlist" .xml )
        if ! python3 "$repository/utilities/KiBOM/KiBOM_CLI.py" -d bom "$netlist" "$bom_name.html"; then
            abort
        fi  
done
apcountryman commented 3 years ago

A few things:

Other than these, this design LGTM. I'll open a type-feature issue for implementing this new feature shortly.