feat(ecad): Update ECAD to support latest atopile and fix some bugs #154
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| atopile: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Official atopile action: resolves the version from requires-atopile | |
| # in ato.yaml and provides `ato` via the atopile-kicad container | |
| # (which bundles kicad-cli), tagged locally as `atopile-local`. | |
| - name: Setup atopile | |
| uses: atopile/setup-atopile@v2 | |
| with: | |
| ato-config: ecad/ato.yaml | |
| # Verify every target builds from the checked-in sources WITHOUT | |
| # modifying the checked-in layouts: --frozen fails the build if the | |
| # PCB would change, and the --keep-* flags take designators, net | |
| # names and picked parts from the boards as-is. | |
| # The LCSC/EasyEDA API is intermittently flaky, hence the retries. | |
| - name: Build all targets (frozen) | |
| working-directory: ecad | |
| run: | | |
| ok=0 | |
| for i in 1 2 3; do | |
| if ato build --frozen --keep-picked-parts --keep-net-names --keep-designators; then | |
| ok=1; break | |
| fi | |
| echo "build failed (attempt $i), retrying in 60s..."; sleep 60 | |
| done | |
| [ "$ok" = "1" ] | |
| # Manufacturing artifacts for the two real boards: | |
| # -t all -> gerber zip, pick & place, BOM, STEP, GLB | |
| # -t 3d-image -> rendered PNG | |
| - name: Export gerbers / STEP / PNG | |
| working-directory: ecad | |
| run: | | |
| ok=0 | |
| for i in 1 2 3; do | |
| if ato build -b box-emu -b box-3-emu -t all -t 3d-image \ | |
| --frozen --keep-picked-parts --keep-net-names --keep-designators; then | |
| ok=1; break | |
| fi | |
| echo "build failed (attempt $i), retrying in 60s..."; sleep 60 | |
| done | |
| [ "$ok" = "1" ] | |
| # PDFs are not an atopile target; render them with the kicad-cli | |
| # bundled in the same atopile-kicad container the action pulled. | |
| - name: Export PDFs | |
| working-directory: ecad | |
| run: | | |
| for b in box-emu box-3-emu; do | |
| docker run --rm -v "$PWD:/work" -w /work --entrypoint kicad-cli atopile-local \ | |
| pcb export pdf --layers "F.Cu,F.Mask,F.SilkS,Edge.Cuts" \ | |
| --output "build/builds/$b/$b.top.pdf" "elec/layout/$b/$b.kicad_pcb" | |
| docker run --rm -v "$PWD:/work" -w /work --entrypoint kicad-cli atopile-local \ | |
| pcb export pdf --mirror --layers "B.Cu,B.Mask,B.SilkS,Edge.Cuts" \ | |
| --output "build/builds/$b/$b.bottom.pdf" "elec/layout/$b/$b.kicad_pcb" | |
| done | |
| - name: Collect release bundles | |
| working-directory: ecad | |
| run: | | |
| for b in box-emu box-3-emu; do | |
| zip -j "$b.zip" \ | |
| "build/builds/$b/$b.gerber.zip" \ | |
| "build/builds/$b/$b.pcba.step" \ | |
| "build/builds/$b/$b.pcba.png" \ | |
| "build/builds/$b/$b.pcba.glb" \ | |
| "build/builds/$b/$b.top.pdf" \ | |
| "build/builds/$b/$b.bottom.pdf" \ | |
| "build/builds/$b/$b.bom.csv" \ | |
| "build/builds/$b/$b.pick_and_place.csv" \ | |
| "build/builds/$b/$b.jlcpcb_pick_and_place.csv" | |
| done | |
| - name: Upload Box-Emu | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: box-emu | |
| path: | | |
| ecad/build/builds/box-emu/box-emu.gerber.zip | |
| ecad/build/builds/box-emu/box-emu.pcba.step | |
| ecad/build/builds/box-emu/box-emu.pcba.png | |
| ecad/build/builds/box-emu/box-emu.pcba.glb | |
| ecad/build/builds/box-emu/box-emu.top.pdf | |
| ecad/build/builds/box-emu/box-emu.bottom.pdf | |
| ecad/build/builds/box-emu/box-emu.bom.csv | |
| ecad/build/builds/box-emu/box-emu.pick_and_place.csv | |
| ecad/build/builds/box-emu/box-emu.jlcpcb_pick_and_place.csv | |
| - name: Upload Box-3-Emu | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: box-3-emu | |
| path: | | |
| ecad/build/builds/box-3-emu/box-3-emu.gerber.zip | |
| ecad/build/builds/box-3-emu/box-3-emu.pcba.step | |
| ecad/build/builds/box-3-emu/box-3-emu.pcba.png | |
| ecad/build/builds/box-3-emu/box-3-emu.pcba.glb | |
| ecad/build/builds/box-3-emu/box-3-emu.top.pdf | |
| ecad/build/builds/box-3-emu/box-3-emu.bottom.pdf | |
| ecad/build/builds/box-3-emu/box-3-emu.bom.csv | |
| ecad/build/builds/box-3-emu/box-3-emu.pick_and_place.csv | |
| ecad/build/builds/box-3-emu/box-3-emu.jlcpcb_pick_and_place.csv | |
| - name: Attach files to release | |
| uses: softprops/action-gh-release@v2 | |
| if: ${{ github.event.release && github.event.action == 'published' }} | |
| with: | |
| files: | | |
| ecad/box-3-emu.zip | |
| ecad/box-emu.zip |