Initial commit

This commit is contained in:
2025-10-22 00:50:46 -07:00
commit c378b6a813
34 changed files with 5938 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
{{! hash schema }}
{{! {
"project_name" : "the name of the project",
"time" : "the name of the project",
"date" : "the name of the project",
"total_parts" : "number",
"total_cost" : "number",
"parts" : [
{
"Reference" : "part_reference" ,
"Value" : "the value of the part" ,
"Quantity" : "number" ,
"part_number" : "the part number" ,
"cost" : "number"
}
]
} }}
# 📄 BOM for {{project_name}} 📄
report created at {{time}} on {{date}}.
{{project_name}} has a total of {{total_parts}} parts with a cost of ${{total_cost}}.
| Reference | Value | Quantity | part number | cost |
| --------- | ----- | -------- | ----------- | ---- |
{{#parts}}
| {{Reference}} | {{Value}} | {{Quantity}} | {{part_number}} | ${{cost}} |
{{/parts}}
| | total | {{total_parts}} | total | ${{total_cost}} |

View File

@@ -0,0 +1,133 @@
{{! hash schema }}
{{! {
"date" : "the date of creation",
"time" : "the time of creation",
"total_warns" : "number",
"total_errors" : "number",
"has_violations" : "flag to say if the project has a violation",
"violations" : {
"number_of_errors" : "number",
"number_of_warns" : "number",
"warns" : [
{
"name" : "string",
"content" : "string"
}
],
"errors" : [
{
"name" : "string",
"content" : "string"
}
]
},
"unconnected_items" : {
"number_of_errors" : "number",
"number_of_warns" : "number",
"warns" : [
{
"name" : "string",
"content" : "string"
}
],
"errors" : [
{
"name" : "string",
"content" : "string"
}
]
},
"schematic_parity" :{
"number_of_errors" : "number",
"number_of_warns" : "number",
"warns" : [
{
"name" : "string",
"content" : "string"
}
],
"errors" : [
{
"name" : "string",
"content" : "string"
}
]
}
} }}
# 📟 {{project_name}} DRC report 📟
report created at {{time}} 🕧 on {{date}} 🗓️.
the design rule check found:
- {{total_errors}} errors in your design 😱
- {{total_warns}} warns in your design 🫨
{{#has_violations}}
number of errors and warns breakdown per sheet:
| error type | number of errors 🔴 | number of warns 🟠 |
| ----------------------------------------- | -------------------------------------- | ------------------------------------- |
| [violations](#violations) ❌ | {{violations.number_of_errors}} | {{violations.number_of_warns}} |
| [unconnected items](#unconnected-items) ⛓️‍💥| {{unconnected_items.number_of_errors}} | {{unconnected_items.number_of_warns}} |
| [schematic parity](#schematic-parity) 🔗 | {{schematic_parity.number_of_errors}} | {{schematic_parity.number_of_warns}} |
| total | {{total_errors}} | {{total_warns}} |
below is a more in-depth breakdown of the errors and warns per error type.
note you should only use this for quickly checking that the project
you uploaded has no error or warn. YOU SHOULD *NOT* use this to actually
run the drc in kicad so you can see where is erroring.
# violations
## errors : {{violations.number_of_errors}}
{{#violations.errors}}
### {{name}}
{{content}}
{{loction}}
{{/violations.errors}}
## warns : {{violations.number_of_warns}}
{{#violations.warns}}
### {{name}}
{{content}}
{{loction}}
{{/violations.warns}}
# unconnected items
## errors : {{unconnected_items.number_of_errors}}
{{#unconnected_items.errors}}
### {{name}}
{{content}}
{{loction}}
{{/unconnected_items.errors}}
## warns : {{unconnected_items.number_of_warns}}
{{#unconnected_items.warns}}
### {{name}}
{{content}}
{{loction}}
{{/unconnected_items.warns}}
# schematic parity
## errors : {{schematic_parity.number_of_errors}}
{{#schematic_parity.errors}}
### {{name}}
{{content}}
{{loction}}
{{/schematic_parity.errors}}
## warns : {{schematic_parity.number_of_warns}}
{{#schematic_parity.warns}}
### {{name}}
{{content}}
{{loction}}
{{/schematic_parity.warns}}
{{/has_violations}}
{{^has_violations}}
the design had no errors or warns, good job. ✅✅
{{/has_violations}}

View File

@@ -0,0 +1,73 @@
{{! hash schema }}
{{! {
"date" : "the date of creation",
"time" : "the time of creation",
"total_warns" : "number",
"total_errors" : "number",
"has_violations" : "flag to say if the project has a violation",
"sheets" : [
{
"name" : "string",
"name_md" : "just name but i replaced the spaces with hyphens",
"number_of_errors" : "number",
"number_of_warns" : "number",
"warns" : [
{
"name" : "string",
"content" : "string"
}
],
"errors" : [
{
"name" : "string",
"content" : "string"
}
]
}
]
} }}
# ⚡{{project_name}} ERC report ⚡
report created at {{time}} 🕧 on {{date}} 🗓️.
the electronic rules check found:
- {{total_errors}} errors in your design 😱
- {{total_warns}} warns in your design 🫨
{{#has_violations}}
number of errors and warns breakdown per sheet:
| sheet name 📄| number of errors 🔴 | number of warns 🟠 |
| ---------- | ---------------- | --------------- |
{{#sheets}}
| [{{name}}](#{{name_md}}) | {{number_of_errors}} | {{number_of_warns}} |
{{/sheets}}
| total | {{total_errors}}| {{total_warns}}|
below is a more in-depth breakdown of the errors and warn per sheets.
note you should only use this for quickly checking that the project
you uploaded has no error or warn. YOU SHOULD *NOT* use this to actually
run your ERC in kicad so you can see where is erroring.
{{#sheets}}
# {{name}}
## errors : {{number_of_errors}}
{{#errors}}
### {{name}}
{{content}}
{{/errors}}
## warns : {{number_of_warns}}
{{#warns}}
### {{name}}
{{content}}
{{/warns}}
{{/sheets}}
{{/has_violations}}
{{^has_violations}}
the design had no errors or warns, good job. ✅✅
{{/has_violations}}

View File

@@ -0,0 +1,5 @@
# how the templates work
templates work by using a json file to fill in the templating spots. for more information on the templates checkout [mustache templates](https://mustache.github.io/). these templates use a json file format as what they call a "hash" to fill out the templates. the hashs for each of these templates are layout at the top of each of the `.mustache` files in a comment. These are also the hashes outputted by the processing scripts. usages for these scripts are at the top of the file.
if any schema says bool this actually means the value is either something or either doesnt exist/null.

153
.github/report_templates/readme.mustache vendored Normal file
View File

@@ -0,0 +1,153 @@
{{! hash schema }}
{{! {
"badge" : "the ci badge",
"lastest_action_run_link" : "link to the lastest action",
"did_error" : "to check if errors occured in the pipeline",
"title" : "the tiltle of the project, can be set in project_settings or it will use the repo name",
"multiple_projects" : "bool",
"projects" : [
{
"project_name" : "string",
"project_link" : "link",
"passing_erc" : "bool",
"passing_erc_emoji" : "string",
"erc_summary_link" : "link",
"passing_drc" : "bool",
"passing_drc_emoji" : "string",
"drc_summary_link" : "link",
"gerber_link" : "link",
"schematic_link" : "link",
"bom_report_link" : "link",
"bom_csv_link" : "link"
}
]
} }}
# kicad project {{title}}
{{badge}}
{{! [![.github/workflows/main.yaml](https://github.com/sirlilpanda/kicad-project-template/actions/workflows/main.yaml/badge.svg)](https://github.com/sirlilpanda/kicad-project-template/actions/workflows/main.yaml) }}
a cool table showing the workflow of all the kicad projects.
| project_name | DRC | ERC |
| ------------ | --- | --- |
{{#projects}}
| {{project_name}} | [{{passing_erc_emoji}}]({{erc_summary_link}})| [{{passing_drc_emoji}}]({{drc_summary_link}}) |
{{/projects}}
for a quick guide check [project setup](#project-setup)
This is a simple project template for new kicad projects. This template has some basic setup already completed such as workflows for auto creating all the things you forget when creating a kicad project such as:
{{^multiple_projects}}
{{#projects}}
- [gerbers]({{gerber_link}})
- [bom]({{bom_report_link}})
- [schematic pdf]({{schematic_link}})
{{/projects}}
{{/multiple_projects}}
{{#multiple_projects}}
| project_name | schematic | bom | bom report | gerbers |
| ------------ | --------- | --- | ---------- | ------- |
{{#projects}}
| [{{project_name}}]({{project_link}}) | [{{project_name}}_schematic.pdf]({{schematic_link}}) | [{{project_name}}_bill_of_materials.csv]({{bom_csv_link}}) | [{{project_name}}_bom_report.md]({{bom_report_link}}) | [{{project_name}}_grbr.zip]({{gerber_link}}) |
{{/projects}}
{{/multiple_projects}}
This workflow will also run the design rules check on the PCB and schematic to ensure that you upload a working PCB. These reports are uploaded as summaries within the github [actions tab]({{lastest_action_run_link}}). This template has a simple schematic PCB in it (because DRC fails on an empty PCB). Shown below is the example PCB.
![example pcb with battery diode and resistor](res/image.png)
besides from that the project also has:
- common predefined trace widths
- smallest vias size [JLCPBC allows](https://jlcpcb.com/capabilities/Capabilities#Drilling)
- custom net colours in the schematic editor
- `red` for +V
- `blue` for -V
- `grey` for ground
to create a repo from this template follow this [guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)
contained in this template are:
---
- `.github/` : all files relating to github actions and other admin see [here](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions) for more example of what can be placed in it
- `report_processing` : where the python scripts are stored for processing the json report data from kicad
- `report_templates` : where the template for said reports are stored
- `workflows/` : this is where the github actions are kept
- `main.yaml` : the main github action that will auto generate all files required and run DRC and ERC
- `rename.py` : the script for renaming the project
- `hardware/` : this is where the kicad projects live note this can be changed
- `docs/` : this is where the generate docs are placed by default
- `BOM/` : where the bill of materials and price breakdown are kept
- `bill_of_materials.csv`: the auto generated bom for the kicad project
- `bom_report.md` : a report for the bill of materials
- `template_schematic.pdf` : the schematic for the kicad project, auto generated by the github action
- `pcbs/` : this is where the auto generated gerbers for the kicad project are stored
- `res/` : where resources are stored for the README
- `.gitignore`: a slightly modified gitignore from the [standard one](https://github.com/github/gitignore/blob/main/KiCad.gitignore)
- `project_settings.yaml` : where the settings for this project is stored
- `README.md` : this file, suggest you change this one creating your project
## project settings
there are currently very few project settings that can be changed (will will be change in the future) these are:
| setting | description |
| --------------------------- | ----------------------------------------------------------------- |
| has_been_set_up | a flag to tell the setup action if the project has been set up |
| project_name | the name of the project, this will be set to the name of the repo |
| production_formats | the output production format for the PCBs |
| dynamic_read_me | allow the readme to be updated using the given template |
| bom_template_path | the template used to write the bom report files |
| erc_report_template_path | the template used to write the erc report files |
| drc_report_template_path | the template used to write the drc report files |
| readme_template_path | the template used to write projects readme |
| schematic_output_name | the name suffix of the generated schematics |
| bom_csv_output_name | the name suffix of the generated bom csv file |
| bom_report_output_name | the name suffix of the generated bom report |
| production_file_output_name | the name suffix of the generated production file |
| schematic_output_path | the output path of the generated schematics files |
| bom_csv_output_path | the output path of the generated bom csv file |
| bom_report_output_path | the output path of the generated bom report |
| production_file_output_path | the output path of the generated production file |
## project setup
### creating a new repo with the template
creating a new template from a repo is simple:
1. click on the button in the top right hand corner called `use this template`
![alt text](res/image-5.png)
2. when the drop down menu appears click on `create a new repository`
![alt text](res/image-6.png)
3. once you click you will be brought to this page, note that the repo name you choose here will be the name that you kicad project is called.
![alt text](res/image-7.png)
after these steps you then need to configure the repo settings to do their magic see [configuring repo settings](#configuring-repo-settings) for what to do next.
### configuring repo settings
once you have created a new repo with the template, you ill have to configure the github action settings. this is because you will get an error that looks something along these lines:
![alt text](res/image-4.png)
where the action can not commit the changes due to not having permissions follow these steps:
1. open the repo setting
![alt text](res/image-1.png)
2. then head in to actions : General
![alt text](res/image-2.png)
3. then scroll down to workflow permissions and ensure that both
`Read and write permissions` and `Allow GitHub Actions to create and approve pull requests` are ticked as seen below
![alt text](res/image-3.png)
this should fix the problem if not, go harass stack overflow they need it
Once all of these steps have been followed the workflow should be passing, however the `README.md` will only update on the next push request.
## editing the readme
As this repo can and will automatically update the repo corresponding to the given readme template. If you dont want to use this you can always disable this by setting the `dynamic_read_me` to `false`. but if you want some very cool features like auto updating tables to show what projects are passing the rules check or simple links to parts of your directory. then have a look at the template readme and learn [mustache](https://mustache.github.io/)
## improvements