Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,40 @@ jobs:
See this example working in the action runs of this repository.

## Configuration

| Option | Description | Default |
|--------------------|-------------------------------------------------|------------------------------|
| `kicad_sch` | Path to `.kicad_sch` file | |
| `sch_erc` | Whether to run ERC on the schematic | `false` |
| `sch_erc_file` | Output filename of ERC report | `erc.rpt` |
| `sch_pdf` | Whether to generate PDF from schematic | `false` |
| `sch_pdf_file` | Output filename of PDF schematic | `sch.pdf` |
| `sch_bom` | Whether to generate BOM from schematic | `false` |
| `sch_bom_file` | Output filename of BOM | `bom.csv` |
| `sch_bom_preset` | Name of a BOM preset setting to use | |
| `report_format` | ERC/DRC report file format (`json` or `report`) | `report` |
| | | |
| `kicad_pcb` | Path to `.kicad_pcb` file | |
| `pcb_drc` | Whether to run DRC on the PCB | `false` |
| `pcb_drc_file` | Output filename for DRC report | `drc.rpt` |
| `pcb_gerbers` | Whether to generate Gerbers from PCB | `false` |
| `pcb_gerbers_file` | Output filename of Gerbers | `gbr.zip` |
| `pcb_image` | Whether to render the PCB image | `false` |
| `pcb_image_path` | Where to put the top.png and bottom.png | `images` |
| `pcb_model` | Whether to export the PCB model | `false` |
| `pcb_model_file` | Output filename of PCB model | `pcb.step` |
| `pcb_model_flags` | Flags to add when exporting STEP files | see [action.yml](action.yml) |
| Option | Description | Default |
|----------------------|------------------------------------------------------------------|------------------------------|
| `kicad_sch` | Path to the `.kicad_sch` file | |
| `sch_erc` | Whether to run ERC (Electrical Rules Check) on the schematic | `false` |
| `sch_erc_file` | Output filename for the ERC report | `erc.rpt` |
| `sch_pdf` | Whether to generate a PDF from the schematic | `false` |
| `sch_pdf_file` | Output filename for the schematic PDF | `sch.pdf` |
| `sch_bom` | Whether to generate a BOM (Bill of Materials) from the schematic | `false` |
| `sch_bom_file` | Output filename for the BOM | `bom.csv` |
| `sch_bom_preset` | Name of a BOM preset to use | |
| `report_format` | Format for ERC/DRC reports (`json` or `report`) | `report` |
| | | |
| `kicad_pcb` | Path to the `.kicad_pcb` file | |
| `pcb_drc` | Whether to run DRC (Design Rules Check) on the PCB | `false` |
| `pcb_drc_file` | Output filename for the DRC report | `drc.rpt` |
| `pcb_gerbers` | Whether to generate Gerber files from the PCB | `false` |
| `pcb_gerbers_file` | Output filename for the Gerber archive | `gbr.zip` |
| `pcb_gerbers_layers` | Comma-separated list of PCB layers to include in Gerber output: | |
| | `F.Cu,B.Cu,F.SilkS,B.SilkS,F.Mask,B.Mask,Edge.Cuts` | |
| `pcb_centroids` | Whether to generate centroid (component placement) files from PCB| `false` |
| `pcb_centroids_file` | Output filename of centroid (component placement) | `cnt.pos` |
| `pcb_centroids_format`| Output format to generate centroid files from PCB | `ascii` |
| `pcb_image` | Whether to render top and bottom PCB images | `false` |
| `pcb_image_path` | Output directory for `top.png` and `bottom.png` | `images` |
| `pcb_model` | Whether to export a 3D model of the PCB | `false` |
| `pcb_model_file` | Output filename for the 3D model | `pcb.step` |
| `pcb_model_flags` | Additional flags to use when exporting the STEP model | See [action.yml](action.yml) |

## Roadmap

- [ ] Add support for more configuration options, e.g. BOM format or Gerber layers
- [ ] Add support for more configuration options, e.g. BOM format
- [ ] Add a way to specify KiCad version to use
- [ ] Better detect if steps of this action fail
- [ ] Find a better way to enforce the default output files extensions depending on the format requesed
- [ ] Find a better way to enforce the default output files extensions depending on the format requested

## Contributing

Expand Down
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ inputs:
pcb_gerbers_file:
description: 'Output filename of Gerbers ZIP'
default: 'gbr.zip'
pcb_gerbers_layers:
description: 'Output layers to generate from PCB'
default: ''
pcb_centroids:
description: 'Whether to generate centroid (component placement) files from PCB'
default: false
pcb_centroids_file:
description: 'Output filename of centroid (component placement)'
default: 'cnt.pos'
pcb_centroids_format:
description: 'Output format to generate centroid (component placement) files from PCB'
default: 'ascii'
pcb_image:
description: 'Whether to render the PCB image'
default: false
Expand Down
26 changes: 23 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ then
kicad-cli sch erc \
--output "`dirname $INPUT_KICAD_SCH`/$INPUT_SCH_ERC_FILE" \
--format $INPUT_REPORT_FORMAT \
--severity-error \
--exit-code-violations \
"$INPUT_KICAD_SCH"
erc_violation=$?
Expand Down Expand Up @@ -42,6 +43,7 @@ then
kicad-cli pcb drc \
--output "`dirname $INPUT_KICAD_PCB`/$INPUT_PCB_DRC_FILE" \
--format $INPUT_REPORT_FORMAT \
--severity-error \
--exit-code-violations \
"$INPUT_KICAD_PCB"
drc_violation=$?
Expand All @@ -51,9 +53,16 @@ fi
if [[ -n $INPUT_KICAD_PCB ]] && [[ $INPUT_PCB_GERBERS = "true" ]]
then
GERBERS_DIR=`mktemp -d`
kicad-cli pcb export gerbers \
--output "$GERBERS_DIR/" \
"$INPUT_KICAD_PCB"
if [[ -n $INPUT_PCB_GERBERS_LAYERS ]]; then
kicad-cli pcb export gerbers \
--layers "$INPUT_PCB_GERBERS_LAYERS" \
--output "$GERBERS_DIR/" \
"$INPUT_KICAD_PCB"
else
kicad-cli pcb export gerbers \
--output "$GERBERS_DIR/" \
"$INPUT_KICAD_PCB"
fi
kicad-cli pcb export drill \
--output "$GERBERS_DIR/" \
"$INPUT_KICAD_PCB"
Expand All @@ -62,6 +71,17 @@ then
"$GERBERS_DIR"/*
fi

# Export centroid (placement) file if requested
if [[ -n "$INPUT_KICAD_PCB" && "$INPUT_PCB_CENTROIDS" == "true" ]]
then
echo "Exporting centroid (placement) file to $INPUT_PCB_CENTROIDS_FILE..."
kicad-cli pcb export pos \
--format "$INPUT_PCB_CENTROIDS_FORMAT" \
--output "`dirname $INPUT_KICAD_PCB`/$INPUT_PCB_CENTROIDS_FILE" \
--units mm \
"$INPUT_KICAD_PCB"
fi

if [[ -n $INPUT_KICAD_PCB ]] && [[ $INPUT_PCB_IMAGE = "true" ]]
then
mkdir -p "`dirname $INPUT_KICAD_PCB`/$INPUT_PCB_IMAGE_PATH"
Expand Down