changed dl and diff
Some checks failed
KiBot PCB Generation / generate (push) Failing after 26s
KiBot PCB Generation / deploy (push) Has been skipped

This commit is contained in:
2025-09-08 16:32:36 +07:00
parent 055e9f4792
commit 75f74bfe30

View File

@@ -1,480 +1,297 @@
# KiBot configuration for 2/4/6 layer boards - name: Download component datasheets
# Works with Gitea CI/CD pipeline if: steps.config_check.outputs.found == 'true'
continue-on-error: true
run: |
echo "Datasheets will be downloaded by KiBot's download_datasheets output"
echo "They will be saved in Generated/BoM/Datasheets/"
kibot: # Create a README for the datasheets folder if KiBot creates it
version: 1 if [ -d "${GITHUB_WORKSPACE}/Generated/BoM/Datasheets" ]; then
cat > "${GITHUB_WORKSPACE}/Generated/BoM/Datasheets/README.md" << EOF
# Component Datasheets
global: This folder contains downloaded datasheets for components used in the project.
# Filters for ERC/DRC warnings
filters:
- number: 1007
- number: 1015
- number: 58
- number: 61
# Default output directory - will be overridden by command line - Datasheets are downloaded automatically from URLs in the schematic
# output: 'Fabrication' # Commented out to use command line option - Files are named based on the component reference and original filename
- Only unique datasheets are downloaded (duplicates are linked)
# Variant for assembly if needed Generated on: $(date)
variant: '' Project: ${{ steps.find_project.outputs.project_name }}
EOF
# Date format for filenames echo "Datasheet folder contents:"
date_format: '%Y-%m-%d_%H-%M-%S' ls -la "${GITHUB_WORKSPACE}/Generated/BoM/Datasheets/" || true
else
echo "Note: Datasheet folder not created yet - will be created by KiBot"
finame: "KiBot PCB Generation"
preflight: # Controls when the action will run
run_erc: true on:
run_drc: true push:
check_zone_fills: true paths:
ignore_unconnected: false - '**/*.kicad_sch'
update_xml: true - '**/*.kicad_pcb'
erc: - '**/*.kicad_pro'
warnings_as_errors: false - 'kibot.yaml'
# Continue even if ERC fails - '.gitea/workflows/*.yml'
dont_stop: true pull_request:
drc: paths:
warnings_as_errors: false - '**/*.kicad_sch'
# Continue even if DRC fails - '**/*.kicad_pcb'
dont_stop: true - '**/*.kicad_pro'
- 'kibot.yaml'
outputs: - '.gitea/workflows/*.yml'
# Schematic outputs repository_dispatch:
- name: 'print_sch' types: [run_qs]
comment: "Schematic PDF" workflow_dispatch:
type: pdf_sch_print inputs:
dir: Schematic board_layers:
description: 'Number of PCB layers'
required: false
default: '2'
type: choice
options: options:
output: '%f-schematic.%x' - '2'
- '4'
- '6'
- name: 'print_sch_svg' # A workflow run is made up of one or more jobs that can run sequentially or in parallel
comment: "Schematic SVG" jobs:
type: svg_sch_print generate:
dir: Schematic runs-on: kicad-kibot-runner
options:
output: '%f-schematic.%x'
# PCB 2D renders steps:
- name: 'pcb_top' - uses: actions/checkout@v3
comment: "PCB render top" with:
type: pcbdraw # So we can run a diff between last 2 changes
dir: PCB/2D_render fetch-depth: '0'
options:
output: '%f-top.%x'
format: svg
show_components: all
dpi: 300
- name: 'pcb_bottom' - name: Find KiCad project
comment: "PCB render bottom" id: find_project
type: pcbdraw run: |
dir: PCB/2D_render # Find all .kicad_pcb files in the repository
options: PCB_FILES=$(find . -name "*.kicad_pcb" -type f | grep -v -E '/(backups?|backup|old|archive|deprecated)/' | head -5)
output: '%f-bottom.%x'
format: svg
bottom: true
show_components: all
dpi: 300
# PCB PDF documentation if [ -z "$PCB_FILES" ]; then
- name: 'print_pcb' echo "Error: No KiCad PCB files found"
comment: "PCB PDF" exit 1
type: pdf_pcb_print fi
dir: PCB/PDF
options:
output: '%f-pcb.%x'
plot_sheet_reference: true
monochrome: false
pages:
- layers:
- F.Cu
- F.Paste
- F.Silkscreen
- Edge.Cuts
sheet: 'Front copper'
- layers:
- B.Cu
- B.Paste
- B.Silkscreen
- Edge.Cuts
mirror: true
sheet: 'Bottom copper'
- layers:
- In1.Cu
- Edge.Cuts
sheet: 'Inner layer 1'
skip_if_no_layer: true
- layers:
- In2.Cu
- Edge.Cuts
sheet: 'Inner layer 2'
skip_if_no_layer: true
- layers:
- In3.Cu
- Edge.Cuts
sheet: 'Inner layer 3'
skip_if_no_layer: true
- layers:
- In4.Cu
- Edge.Cuts
sheet: 'Inner layer 4'
skip_if_no_layer: true
# Gerber files - automatically handles 2/4/6 layers # Use the first PCB file found
- name: 'gerbers' PCB_FILE=$(echo "$PCB_FILES" | head -1)
comment: "Gerber files" PROJECT_DIR=$(dirname "$PCB_FILE")
type: gerber PROJECT_NAME=$(basename "$PCB_FILE" .kicad_pcb)
dir: Gerbers
options:
output: '%f%i.%x'
exclude_edge_layer: true
exclude_pads_from_silkscreen: true
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: false
force_plot_invisible_refs_vals: false
tent_vias: true
use_protel_extensions: false
create_gerber_job_file: true
disable_aperture_macros: true
gerber_precision: 4.6
use_gerber_x2_attributes: false
use_gerber_net_attributes: false
line_width: 0.1
subtract_mask_from_silk: true
layers:
# Copper layers - automatically included if present
- F.Cu
- B.Cu
- In1.Cu
- In2.Cu
- In3.Cu
- In4.Cu
# Technical layers
- F.Paste
- B.Paste
- F.Silkscreen
- B.Silkscreen
- F.Mask
- B.Mask
- Edge.Cuts
- User.Comments
- F.Fab
- B.Fab
# Excellon drill files echo "Found KiCad project: $PROJECT_NAME"
- name: 'drill' echo "Project directory: $PROJECT_DIR"
comment: "Drill files" echo "PCB file: $PCB_FILE"
type: excellon
dir: Gerbers
options:
output: '%f%i.%x'
metric_units: true
minimal_header: false
mirror_y_axis: false
report:
filename: '%f-drill_report.txt'
pth_and_npth_single_file: false
# Drill map # Find schematic file
- name: 'drill_map' SCH_FILE=$(find "$PROJECT_DIR" -name "*.kicad_sch" -o -name "*.sch" | head -1)
comment: "Drill map"
type: gerb_drill
dir: Gerbers
options:
output: '%f-drill_map.%x'
# Pick and place files echo "pcb_file=$PCB_FILE" >> $GITHUB_OUTPUT
- name: 'position' echo "project_dir=$PROJECT_DIR" >> $GITHUB_OUTPUT
comment: "Pick and place file" echo "project_name=$PROJECT_NAME" >> $GITHUB_OUTPUT
type: position echo "sch_file=$SCH_FILE" >> $GITHUB_OUTPUT
dir: Assembly
options:
output: '%f-position-%i.%x' # Added %i to differentiate front/back files
format: CSV
units: millimeters
separate_files_for_front_and_back: true
only_smd: false
# Interactive BOM # List all found projects for debugging
- name: 'ibom' echo "All PCB files found:"
comment: "Interactive BOM" echo "$PCB_FILES"
type: ibom
dir: Assembly
options:
output: '%f-ibom.%x'
dark_mode: false
hide_pads: false
show_fabrication: false
hide_silkscreen: false
highlight_pin1: true
no_redraw_on_drag: false
board_rotation: 0
check_extra_fields: false
include_tracks: false
include_nets: false
# Generic BOM in CSV format - name: Set layer count
- name: 'bom_csv' id: layers
comment: "Bill of Materials in CSV format" run: |
type: bom # Use workflow input or default to 4 layers
dir: BoM/Generic LAYERS="${{ github.event.inputs.board_layers }}"
options: if [ -z "$LAYERS" ]; then
output: '%f_bom.%x' LAYERS="4" # Change this default if needed
format: CSV fi
separator: ',' echo "layers=$LAYERS" >> $GITHUB_OUTPUT
ref_separator: ',' echo "Using $LAYERS layer configuration"
group_fields: ['Value', 'Footprint', 'Tolerance', 'Voltage']
columns:
- field: 'References'
name: 'Reference'
- field: 'Value'
name: 'Value'
- field: 'Quantity Per PCB'
name: 'Qty'
- field: 'Footprint'
name: 'Package'
- field: 'Description'
name: 'Description'
- field: 'Manufacturer'
name: 'Manufacturer'
- field: 'MPN'
name: 'Part Number'
- field: 'LCSC'
name: 'LCSC Part'
- field: 'Digikey'
name: 'Digikey Part'
- field: 'Mouser'
name: 'Mouser Part'
# Generic BOM in HTML format - name: Check for KiBot config
- name: 'bom_html' id: config_check
comment: "Bill of Materials in HTML format" run: |
type: bom # Check if kibot.yaml exists in repository root
dir: BoM/Generic if [ -f "kibot.yaml" ]; then
options: echo "found=true" >> $GITHUB_OUTPUT
output: '%f_bom.%x' echo "Using kibot.yaml configuration from repository root"
format: HTML else
html: echo "found=false" >> $GITHUB_OUTPUT
style: 'modern-blue' # Style for HTML output echo "No kibot.yaml found in repository root - will use --quick-start mode"
datasheet_as_link: 'Datasheet' # Column name for datasheet links fi
generate_dnf: true
logo: false
title: 'Bill of Materials - %f'
group_fields: ['Value', 'Footprint', 'Tolerance', 'Voltage']
columns:
- field: 'References'
name: 'Reference'
- field: 'Value'
name: 'Value'
- field: 'Quantity Per PCB'
name: 'Qty'
- field: 'Footprint'
name: 'Package'
- field: 'Description'
name: 'Description'
- field: 'Manufacturer'
name: 'Manufacturer'
- field: 'MPN'
name: 'Part Number'
- field: 'LCSC'
name: 'LCSC Part'
- field: 'Digikey'
name: 'Digikey Part'
- field: 'Mouser'
name: 'Mouser Part'
# Generic BOM in XLSX format - name: Run ERC
- name: 'bom_xlsx' if: steps.config_check.outputs.found == 'true'
comment: "Bill of Materials in Excel format" run: |
type: bom cd "${{ steps.find_project.outputs.project_dir }}"
dir: BoM/Generic
options:
output: '%f_bom.%x'
format: XLSX
xlsx:
datasheet_as_link: 'Datasheet' # Column name for datasheet links
generate_dnf: true
logo: false
title: 'Bill of Materials'
max_col_width: 50
highlight_empty: true
group_fields: ['Value', 'Footprint', 'Tolerance', 'Voltage']
columns:
- field: 'References'
name: 'Reference'
- field: 'Value'
name: 'Value'
- field: 'Quantity Per PCB'
name: 'Qty'
- field: 'Footprint'
name: 'Package'
- field: 'Description'
name: 'Description'
- field: 'Manufacturer'
name: 'Manufacturer'
- field: 'MPN'
name: 'Part Number'
- field: 'LCSC'
name: 'LCSC Part'
- field: 'Digikey'
name: 'Digikey Part'
- field: 'Mouser'
name: 'Mouser Part'
- field: 'Datasheet'
name: 'Datasheet'
# Download datasheets if [ -n "${{ steps.find_project.outputs.sch_file }}" ]; then
- name: 'download_datasheets' echo "Running ERC on schematic files..."
comment: "Download component datasheets" # Use absolute path to config file in repo root
type: download_datasheets kibot -c "${GITHUB_WORKSPACE}/kibot.yaml" -s run_erc -v || true
dir: BoM/Datasheets else
run_by_default: true # Changed to run by default echo "No schematic files found, skipping ERC"
options: fi
output: '%f_datasheets.csv' # CSV list of downloaded files continue-on-error: true
field: 'Datasheet' # Field containing datasheet URLs
dnf: false # Don't download for DNF parts
repeated: false # Don't download the same datasheet twice
# 3D model - name: Run DRC
- name: 'step' if: steps.config_check.outputs.found == 'true'
comment: "3D STEP model" run: |
type: step cd "${{ steps.find_project.outputs.project_dir }}"
dir: 3D
options:
output: '%f-3D.%x'
metric_units: true
origin: grid
no_virtual: true
# Board characteristics report echo "Running DRC on PCB..."
- name: 'report' # Use absolute path to config file in repo root
comment: "Board report" kibot -c "${GITHUB_WORKSPACE}/kibot.yaml" -s run_drc -v || true
type: report continue-on-error: true
dir: .
options:
output: '%f-report.%x'
do_convert: true
# Schematic diff - name: Generate outputs with custom config
- name: 'sch_diff' if: steps.config_check.outputs.found == 'true'
comment: "Schematic diff PDF" run: |
type: diff cd "${{ steps.find_project.outputs.project_dir }}"
dir: DIFF
run_by_default: false # Only run when explicitly requested
options:
output: '%f-schematic-diff.%x'
format: PDF
diff_mode: 'red_green'
old: 'HEAD~1'
new: 'HEAD'
cache_dir: '.cache'
add_link_id: true
only_different: true
# PCB diff echo "Generating outputs for ${{ steps.layers.outputs.layers }} layer board"
- name: 'pcb_diff' echo "Project: ${{ steps.find_project.outputs.project_name }}"
comment: "PCB diff PDF" echo "Using config: ${GITHUB_WORKSPACE}/kibot.yaml"
type: diff
dir: DIFF
run_by_default: false # Only run when explicitly requested
options:
output: '%f-pcb-diff.%x'
format: PDF
diff_mode: 'red_green'
old: 'HEAD~1'
new: 'HEAD'
cache_dir: '.cache'
pcb: true
only_different: true
# JLCPCB fabrication package # Run KiBot with the configuration from repo root
- name: 'jlcpcb_gerbers' # Skip ERC/DRC preflight checks to avoid stopping on errors
comment: "Gerbers for JLCPCB" kibot -c "${GITHUB_WORKSPACE}/kibot.yaml" -s run_erc,run_drc -d Fabrication -v
type: gerber
dir: JLCPCB
options:
output: '%f%i.%x'
exclude_edge_layer: false
exclude_pads_from_silkscreen: true
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: false
force_plot_invisible_refs_vals: false
tent_vias: true
use_protel_extensions: true # JLCPCB prefers Protel extensions
create_gerber_job_file: false # JLCPCB doesn't need this
disable_aperture_macros: true
gerber_precision: 4.6
use_gerber_x2_attributes: false
use_gerber_net_attributes: false
line_width: 0.1
subtract_mask_from_silk: true
layers:
- F.Cu
- B.Cu
- In1.Cu
- In2.Cu
- In3.Cu
- In4.Cu
- F.Paste
- B.Paste
- F.Silkscreen
- B.Silkscreen
- F.Mask
- B.Mask
- Edge.Cuts
# JLCPCB drill files # Move outputs to root Generated folder
- name: 'jlcpcb_drill' mkdir -p "${GITHUB_WORKSPACE}/Generated"
comment: "Drill files for JLCPCB" if [ -d "Fabrication" ]; then
type: excellon cp -r Fabrication/* "${GITHUB_WORKSPACE}/Generated/"
dir: JLCPCB fi
options:
output: '%f%i.%x'
metric_units: true
minimal_header: false
mirror_y_axis: false
pth_and_npth_single_file: false # JLCPCB prefers separate files
# JLCPCB ZIP file - name: Quick Start fallback
- name: 'jlcpcb_zip' if: steps.config_check.outputs.found == 'false'
comment: "JLCPCB fabrication ZIP" run: |
type: compress cd "${{ steps.find_project.outputs.project_dir }}"
dir: . echo "Running KiBot in quick-start mode"
options: kibot --quick-start
output: '%f_JLCPCB_compress.%x'
format: ZIP
files:
- source: JLCPCB/*
dest: /
# Fabrication package (ZIP) # Move outputs to root Generated folder
- name: 'fabrication' mkdir -p "${GITHUB_WORKSPACE}/Generated"
comment: "Fabrication package" if [ -d "Generated" ]; then
type: compress cp -r Generated/* "${GITHUB_WORKSPACE}/Generated/"
dir: . fi
options:
output: '%f-fabrication.%x'
format: ZIP
files:
- source: Gerbers/*
dest: /
- source: PCB/PDF/*
dest: /Documentation
- source: Assembly/*
dest: /Assembly
- source: 3D/*
dest: /3D
# Variants for different layer counts (optional) - name: Add board information to outputs
variants: run: |
- name: 2layer echo "Board configuration: ${{ steps.layers.outputs.layers }} layers" > Generated/board_info.txt
comment: "2 layer board variant" echo "Project: ${{ steps.find_project.outputs.project_name }}" >> Generated/board_info.txt
type: kibom echo "Project path: ${{ steps.find_project.outputs.project_dir }}" >> Generated/board_info.txt
echo "Generated on: $(date)" >> Generated/board_info.txt
echo "Commit: ${{ github.sha }}" >> Generated/board_info.txt
- name: 4layer - name: Fix file permissions
comment: "4 layer board variant" run: |
type: kibom chmod -R a+rw Generated || true
- name: 6layer - name: Retrieve results - All outputs
comment: "6 layer board variant" uses: actions/upload-artifact@v3
type: kibom with:
name: Automatic_outputs
path: Generated
- name: Retrieve results - Gerbers
if: steps.config_check.outputs.found == 'true'
uses: actions/upload-artifact@v3
with:
name: Gerbers-${{ steps.layers.outputs.layers }}layer
path: Generated/Gerbers
- name: Retrieve results - Assembly
if: steps.config_check.outputs.found == 'true'
uses: actions/upload-artifact@v3
with:
name: Assembly-${{ steps.layers.outputs.layers }}layer
path: Generated/Assembly
- name: Retrieve results - BOM
if: steps.config_check.outputs.found == 'true'
uses: actions/upload-artifact@v3
with:
name: BOM-${{ steps.layers.outputs.layers }}layer
path: Generated/BoM
- name: Retrieve results - 3D Model
if: steps.config_check.outputs.found == 'true'
uses: actions/upload-artifact@v3
with:
name: 3D-Model
path: Generated/3D
- name: Retrieve results - Fabrication Package
if: steps.config_check.outputs.found == 'true'
uses: actions/upload-artifact@v3
with:
name: Fabrication-Package-${{ steps.layers.outputs.layers }}layer
path: Generated/*.zip
- name: Retrieve results - JLCPCB Package
if: steps.config_check.outputs.found == 'true'
uses: actions/upload-artifact@v3
with:
name: JLCPCB-${{ steps.layers.outputs.layers }}layer
path: Generated/*_JLCPCB_compress.zip
- name: Retrieve results - Diff Report
if: steps.generate_diff.outputs.has_diff == 'true'
uses: actions/upload-artifact@v3
with:
name: Schematic-PCB-Diff
path: Generated/DIFF
# Deploy to documentation branch
deploy:
runs-on: kicad-kibot-runner
needs: generate
steps:
- uses: actions/checkout@v4
- name: Retrieve results
uses: actions/download-artifact@v3
with:
name: Automatic_outputs
path: Generated
- name: Disable Jekyll
# Jekyll will filter the KiRi folders
run: |
touch Generated/.nojekyll
- name: Push to docu branch
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
# Set up git identity
git config --global user.email "${{ gitea.actor }}@noreply.localhost"
git config --global user.name "${{ gitea.actor }}"
# Get the repository URL and add authentication
REPO_URL=$(git config --get remote.origin.url)
AUTHED_URL=${REPO_URL/https:\/\//https:\/\/${GITEA_TOKEN}@}
# Clone the docu branch into a separate folder
git clone --depth 1 --branch docu "$AUTHED_URL" docu-branch || \
git clone --depth 1 "$AUTHED_URL" docu-branch
cd docu-branch
git checkout -B docu
# Clean old contents and copy new files
rm -rf ./*
cp -r ../Generated/* ./
# Commit and push if there are changes
git add .
if ! git diff --cached --quiet; then
git commit -m "chore: update deployed documentation"
git push --force "$AUTHED_URL" docu
else
echo "No changes to deploy"
fi