Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
emilymclean committed Nov 16, 2024
2 parents d5f2d3b + 2ff06fa commit 3d4aaa0
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 37 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
showConfig: true
configFilePath: ./gitversion.yml
- name: Display SemVer
run: |
Expand Down Expand Up @@ -98,12 +97,23 @@ jobs:
id: render_template
uses: chuhlomin/render-template@v1
with:
template: action.template.yml
template: templates/action.template.yml
result_path: action.yml
vars: |
image: ghcr.io/${{ env.REPOSITORY_LC }}:${{ needs.version.outputs.version }}
image: docker://ghcr.io/${{ env.REPOSITORY_LC }}:${{ needs.version.outputs.version }}
- name: Update README.md
uses: recih/[email protected]
env:
ACTION_REPO: ${{ github.repository }}
ACTION_VERSION: ${{ needs.version.outputs.version }}
with:
template-file: templates/README.template.md
output-file: README.md
engine: mustache
- uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit
with:
commit_message: "Update metadata for ${{ github.event.commits[0].message }}"
release-main:
runs-on: ubuntu-latest
needs:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test

on:
pull_request:
push:
branches: [ master, main, develop ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: FPGAwars/icezum
ref: dbad423670419b82018bf6e33c418fc35558c1be
path: proj
- name: Render template
id: render_template
uses: chuhlomin/render-template@v1
with:
template: templates/action.template.yml
result_path: action.yml
vars: |
image: Dockerfile
- uses: ./
with:
input-file: proj/src-kicad/icezum.kicad_pcb
output-directory: out
position-format: gerber
- uses: actions/upload-artifact@v4
with:
name: test-gerber
path: out/
test-readme-generation:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update README.md
uses: recih/[email protected]
env:
ACTION_REPO: ${{ github.repository }}
ACTION_VERSION: v1.0.0
with:
template-file: templates/README.template.md
output-file: README.md
engine: mustache
- name: Cat
run: cat README.md
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# KicadGerber Action
# kicad-gerber Action

Generates gerber & drill files for a specified PCB and places them in a specified directory

## Inputs

### `input-file`

**Required** The PCB to process

### `output-directory`

The directory in which to place the gerber & drill files. Default "gerber".
| Input | Required | Description | Default |
|-------------------- |---------- |------------------------------------------------------------------------------------------------------------------- |---------- |
| `input-file` || The PCB to process | |
| `output-directory` | | The directory in which to place the gerber & drill files | gerber |
| `drill-format` | | The drill format to use. Options are gerber, excellon, and none | excellon |
| `drill-units` | | The units to use for the drill file. Options are in, and mm. Does nothing if drill format is none or gerber | mm |
| `position-format` | | The position format to use. Options are gerber, csv, ascii, and none | none |
| `position-units` | | The units to use for the position file. Options are in, and mm. Does nothing if position format is none or gerber | in |

## Example usage
```
uses: BenMMcLean/KicadGerber@v1
uses: emilymclean/[email protected]
with:
input-file: pcb.kicad_pcb
```
20 changes: 0 additions & 20 deletions action.template.yml

This file was deleted.

22 changes: 21 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,32 @@ inputs:
description: 'The directory in which to place the output'
required: false
default: "gerber"
drill-format:
description: 'The drill format to use. Options are gerber, excellon, and none.'
required: false
default: "excellon"
drill-units:
description: 'The units to use for the drill file. Options are in, and mm. Does nothing if drill format is none or gerber.'
required: false
default: "mm"
position-format:
description: 'The position format to use. Options are gerber, csv, ascii, and none'
required: false
default: "none"
position-units:
description: 'The units to use for the position file. Options are in, and mm. Does nothing if position format is none or gerber.'
required: false
default: "in"
runs:
using: 'docker'
image: 'ghcr.io/benmmclean/kicadgerber:1.1.0-alpha.30'
image: 'docker://ghcr.io/emilymclean/kicad-gerber:2.0.6'
args:
- ${{ inputs.input-file }}
- ${{ inputs.output-directory }}
- ${{ inputs.drill-format }}
- ${{ inputs.drill-units }}
- ${{ inputs.position-format }}
- ${{ inputs.position-units }}
branding:
icon: 'cpu'
color: 'green'
27 changes: 23 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#!/bin/sh -l
#!/bin/bash

mkdir -p /github/workspace/$2
kicad-cli pcb export drill -o /github/workspace/$2 /github/workspace/$1
kicad-cli pcb export gerbers -o /github/workspace/$2 /github/workspace/$1
output="/github/workspace/$2"
input="/github/workspace/$1"
drill_format="${3:-excellon}"
drill_units="${4:-mm}"
position_format="${5:-ascii}"
position_units="${6:-in}"

filename="$(basename -- "$input" .${input##*.})"

mkdir -p "$output"
kicad-cli pcb export gerbers -o "$output" "$input"

if [[ "$drill_format" == "excellon" || "$drill_format" == "gerber" ]]; then
kicad-cli pcb export drill --format "$drill_format" --excellon-units "$drill_units" -o "$output" "$input"
fi

if [[ "$position_format" == "ascii" || "$position_format" == "csv" ]]; then
kicad-cli pcb export pos --format "$position_format" --units "$drill_units" -o "$output/$filename.pos" "$input"
elif [[ "$position_format" == "gerber" ]]; then
kicad-cli pcb export pos --format gerber --side front -o "$output/$filename.front.pos" "$input"
kicad-cli pcb export pos --format gerber --side back -o "$output/$filename.back.pos" "$input"
fi
21 changes: 21 additions & 0 deletions templates/README.template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# kicad-gerber Action

Generates gerber & drill files for a specified PCB and places them in a specified directory

## Inputs

| Input | Required | Description | Default |
|-------------------- |---------- |------------------------------------------------------------------------------------------------------------------- |---------- |
| `input-file` || The PCB to process | |
| `output-directory` | | The directory in which to place the gerber & drill files | gerber |
| `drill-format` | | The drill format to use. Options are gerber, excellon, and none | excellon |
| `drill-units` | | The units to use for the drill file. Options are in, and mm. Does nothing if drill format is none or gerber | mm |
| `position-format` | | The position format to use. Options are gerber, csv, ascii, and none | none |
| `position-units` | | The units to use for the position file. Options are in, and mm. Does nothing if position format is none or gerber | in |

## Example usage
```
uses: {{{ env.ACTION_REPO }}}@v{{{ env.ACTION_VERSION }}}
with:
input-file: pcb.kicad_pcb
```
40 changes: 40 additions & 0 deletions templates/action.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'KiCad Gerber'
author: 'Emily McLean'
description: 'Generates gerber & drill files for a specified KiCad PCB and places them in a specified directory'
inputs:
input-file:
description: 'The PCB file to process'
required: true
output-directory:
description: 'The directory in which to place the output'
required: false
default: "gerber"
drill-format:
description: 'The drill format to use. Options are gerber, excellon, and none.'
required: false
default: "excellon"
drill-units:
description: 'The units to use for the drill file. Options are in, and mm. Does nothing if drill format is none or gerber.'
required: false
default: "mm"
position-format:
description: 'The position format to use. Options are gerber, csv, ascii, and none'
required: false
default: "none"
position-units:
description: 'The units to use for the position file. Options are in, and mm. Does nothing if position format is none or gerber.'
required: false
default: "in"
runs:
using: 'docker'
image: '{{ .image }}'
args:
- ${{`{{ inputs.input-file }}`}}
- ${{`{{ inputs.output-directory }}`}}
- ${{`{{ inputs.drill-format }}`}}
- ${{`{{ inputs.drill-units }}`}}
- ${{`{{ inputs.position-format }}`}}
- ${{`{{ inputs.position-units }}`}}
branding:
icon: 'cpu'
color: 'green'

0 comments on commit 3d4aaa0

Please sign in to comment.