Skip to content

Commit

Permalink
Only run atopile action on ecad changes and render 3d image output of…
Browse files Browse the repository at this point in the history
… ecad (#77)

* update atopile action to only run on electrical changes and test render 3d with kibot

* remove incorrect type

* update other ci actions to only run when they should

* remove custom data (nonexistent) from print pdf output

* move zip to after kibot

* separate out kibot outputs to make it easier to add them

* remove -j for testing

* add back -j and be explicit about which files to export. remove -r to not recurse subdirectories

* switch from v2_k7 to just v2 to test

* revert version change and add diff view

* remove empty kicad_3d_url key

* testing

* fix duplicate

* remove 3d cache

* test uploading images to pr

* minor update and fix package
  • Loading branch information
finger563 authored Jul 5, 2024
1 parent 5562a4c commit 9cf7fe0
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 9 deletions.
42 changes: 39 additions & 3 deletions .github/workflows/atopile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ name: Electronics Build (Atopile)
on:
pull_request:
branches: [main]
paths:
- 'ecad/*'
- '.github/workflows/atopile.yml'
push:
branches: [main]
paths:
- 'ecad/*'
- '.github/workflows/atopile.yml'
release:
types: [published]
workflow_dispatch:

jobs:
build:
Atopile:
runs-on: ubuntu-latest

steps:
Expand All @@ -23,18 +29,38 @@ jobs:
with:
path: 'ecad/' # atopile project directory

- name: Render Box-Emu PCB
uses: INTI-CMNB/KiBot@v2_k7
with:
# Required - kibot config file
config: ecad/config.kibot.yaml
# optional - prefix to output defined in config
dir: 'ecad/kibot-box-emu'
# optional - PCB design file
board: 'ecad/elec/layout/box-emu/box-emu.kicad_pcb'

- name: Render Box-3-Emu PCB
uses: INTI-CMNB/KiBot@v2_k7
with:
# Required - kibot config file
config: ecad/config.kibot.yaml
# optional - prefix to output defined in config
dir: 'ecad/kibot-box-3-emu'
# optional - PCB design file
board: 'ecad/elec/layout/box-3-emu/box-3-emu.kicad_pcb'

- name: Zip up box-emu files in the build output directory
run: |
cd ecad
# zip all files which match box-emu.* or box-emu-gerbers*.zip
zip -j -r box-emu.zip build/box-emu.* build/box-emu-gerbers*.zip
zip -j box-emu.zip build/box-emu.* build/box-emu-gerbers*.zip kibot-box-emu/*.png kibot-box-emu/*.pdf kibot-box-emu/*.step
cd ..
- name: Zip up box-3-emu files in the build output directory
run: |
cd ecad
# zip all files which match box-3-emu.* or box-3-emu-gerbers*.zip
zip -j -r box-3-emu.zip build/box-3-emu.* build/box-3-emu-gerbers*.zip
zip -j box-3-emu.zip build/box-3-emu.* build/box-3-emu-gerbers*.zip kibot-box-3-emu/*.png kibot-box-3-emu/*.pdf kibot-box-3-emu/*.step
cd ..
- name: Upload Box-3-Emu
Expand All @@ -44,6 +70,7 @@ jobs:
path: |
ecad/build/box-3-emu.*
ecad/build/box-3-emu-gerbers*.zip
ecad/kibot-box-3-emu/*
- name: Upload Box-Emu
uses: actions/upload-artifact@v4
Expand All @@ -52,6 +79,15 @@ jobs:
path: |
ecad/build/box-emu.*
ecad/build/box-emu-gerbers*.zip
ecad/kibot-box-emu/*
- name: Upload Images to PR
uses: edunad/[email protected]
with:
path: 'ecad/kibot-**/*.png'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
title: 'ECAD Images'
annotationLevel: 'notice'

- name: Attach files to release
uses: softprops/action-gh-release@v2
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
name: Build

on: [pull_request]
on:
pull_request:
branches: [main]
paths:
- 'components/*'
- 'main/*'
- 'sdkconfig.defaults'
- 'partitions.csv'
- '.github/workflows/build.yml'
push:
branches: [main]
paths:
- 'components/*'
- 'main/*'
- 'sdkconfig.defaults'
- 'partitions.csv'
- '.github/workflows/build.yml'

jobs:
build:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/package_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
path: '.'
command: './patches.sh && idf.py build'

- name: Zip up firmware binaries
run: |
# zip the firmware bin files and flash args
zip -j -r firmware-binaries.zip build/esp-box-emu.bin build/bootloader/bootloader.bin build/partition_table/partition-table.bin build/flash_args
- name: Zip up firmware binaries
run: |
# zip the firmware bin files and flash args
zip -j -r firmware-binaries.zip build/esp-box-emu.bin build/bootloader/bootloader.bin build/partition_table/partition-table.bin build/flash_args
- name: Upload Build Outputs
uses: actions/upload-artifact@v4
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ on:
pull_request_target:
branches:
- "*"
paths:
- 'components/*'
- 'main/*'
- 'sdkconfig.defaults'
- 'partitions.csv'
- '.github/workflows/static_analysis.yml'

jobs:
static_analysis:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand Down
124 changes: 124 additions & 0 deletions ecad/config.kibot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Example KiBot config file
kibot:
version: 1

global:
solder_mask_color: 'black'
silk_screen_color: 'white'

outputs:
# Export PDF of the board layers (right now just top / bottom)
- name: print_pdf
comment: "PDF for the PCB"
type: pcb_print
options:
force_edge_cuts: true
keep_temporal_files: true
scaling: 2.0
pages:
- layers: [ F.Paste, F.Adhes, Dwgs.User, F.Fab ]
sheet: 'Fabrication layers'
- layers:
- layer: F.Cu
- layer: F.Mask
color: '#14332440'
- layer: F.SilkS
- layer: Dwgs.User
sheet: 'Top layer'
- layers:
- layer: B.Cu
- layer: B.Mask
color: '#14332440'
- layer: B.SilkS
- layer: Dwgs.User
sheet: 'Bottom layer'
mirror: true

# Export STEP file of pcb
- name: 3D
comment: "STEP 3D model"
type: step

# KiCAD render
- name: 3D_top_view
comment: "3D render from top"
type: render_3d
# see https://kibot.readthedocs.io/en/master/configuration/outputs/render_3d.html
options:
zoom: 4
rotate_x: 3
rotate_z: 3
ray_tracing: true

# Blender render
- name: 3D_top_view_HQ
comment: "3D render from top (High Quality)"
type: blender_export
options:
render_options:
transparent_background: true
samples: 20
point_of_view:
rotate_x: 30
rotate_z: -20
outputs:
- type: blender
- type: render

# # Diff:
# # Recursive git submodules aren't supported (submodules inside submodules)
# - name: PCB Diff
# comment: 'Generates a PDF with the differences between two PCBs'
# type: 'diff'
# dir: 'Example/diff_dir'
# options:
# # [number=5] [0,100] Color tolerance (fuzzyness) for the `stats` mode
# fuzz: 5
# # [string='current'] [git,file,output,multivar,current] How to interpret the `new` name. Use `git` for a git hash, branch, etc.
# # Use `current` for the currently loaded PCB/Schematic.
# # Use `file` for a file name. Use `output` to specify the name of a `pcb_variant`/`sch_variant` output.
# # Use `multivar` to compare a set of variants, in this mode `new` is the list of outputs for the variants.
# # This is an extension of the `output` mode.
# # If `old` is also `multivar` then it becomes the reference, otherwise we compare using pairs of variants
# new_type: 'current'
# # [string='HEAD'] Reference file. When using git use `HEAD` to refer to the last commit.
# # Use `HEAD~` to refer the previous to the last commit.
# # As `HEAD` is for the whole repo you can use `KIBOT_LAST-n` to make
# # reference to the changes in the PCB/SCH. The `n` value is how many
# # changes in the history you want to go back. A 0 is the same as `HEAD`,
# # a 1 means the last time the PCB/SCH was changed, etc.
# # Use `KIBOT_TAG-n` to search for the last tag skipping `n` tags.
# # Important: when using the `checkout` GitHub action you just get the
# # last commit. To clone the full repo use `fetch-depth: '0'`
# old: 'HEAD'
# # [string='git'] [git,file,output,multivar] How to interpret the `old` name. Use `git` for a git hash, branch, etc.
# # Use `file` for a file name. Use `output` to specify the name of a `pcb_variant`/`sch_variant` output.
# # Use `multivar` to specify a reference file when `new_type` is also `multivar`
# old_type: 'git'
# # [boolean=false] Only include the pages with differences in the output PDF.
# # Note that when no differences are found we get a page saying *No diff*
# only_different: false
# # [boolean=false] Compare only the main schematic page (root page)
# only_first_sch_page: false
# # [string='%f-%i%I%v.%x'] Filename for the output (%i=diff_pcb/diff_sch, %x=pdf). Affected by global options
# output: '%f-%i%I%v.%x'
# # [boolean=true] Compare the PCB, otherwise compare the schematic
# pcb: true
# # [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
# # A short-cut to use for simple cases where a variant is an overkill
# pre_transform: '_none'
# # [number=0] [0,1000000] Error threshold for the `stats` mode, 0 is no error. When specified a
# # difference bigger than the indicated value will make the diff fail.
# # KiBot will return error level 29 and the diff generation will be aborted
# threshold: 0
# # [boolean=false] When creating the link name of an output file related to a variant use the variant
# # `file_id` instead of its name
# use_file_id: false
# # [string=''] Board variant to apply
# variant: ''
# # [string='global'] [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we
# # fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces
# # a refill, *unfill* forces a zone removal and *none* lets the zones unchanged.
# # Be careful with the cache when changing this setting
# zones: 'global'
# layers: all

0 comments on commit 9cf7fe0

Please sign in to comment.