Enhanced the GitHub action

- Made really optional the SCH and PCB
- Implemented the --skip option
- Added --variant option
This commit is contained in:
Salvador E. Tropea 2022-03-25 10:47:19 -03:00
parent ebb1916aee
commit 6d50e5489b
2 changed files with 41 additions and 12 deletions

View File

@ -1,5 +1,5 @@
name: 'KiBot'
description: 'auto generate exports (schematics, gerbers, plots) for any KiCAD project.'
description: 'auto generate exports (schematics, gerbers, plots) for any KiCad project.'
author: 'Salvador E. Tropea'
inputs:
config:
@ -12,13 +12,19 @@ inputs:
board:
description: 'The PCB .kicad-pcb board file [default: first *.kicad_pcb found]'
required: false
# TODO: fix default 'first *.kicad_pcb file found'
# default: '$(ls *.kicad_pcb | head -n1)'
default: '__SCAN__'
schema:
description: 'The schematic file (.sch) [default: first *.sch found]'
description: 'The schematic file (.sch) [default: first *.*sch found]'
required: false
# TODO: fix default 'first *.sch file found'
# default: '$(ls *.sch | head -n1)'
default: '__SCAN__'
skip:
description: 'Skip preflights, comma separated or "all" [default: no skip]'
required: false
default: '__NONE__'
variant:
description: 'Global variant to use [default: no variants]'
required: false
default: '__NONE__'
verbose:
description: 'Verbosity level [default: 0]'
required: false
@ -31,7 +37,9 @@ runs:
- -d ${{ inputs.dir }}
- -b ${{ inputs.board }}
- -e ${{ inputs.schema }}
- -s ${{ inputs.skip }}
- -v ${{ inputs.verbose }}
- -V ${{ inputs.variant }}
branding:
icon: 'cpu'
color: 'green'

View File

@ -12,6 +12,7 @@ BOARD=""
SCHEMA=""
SKIP=""
DIR=""
VARIANT=""
# Exit error code
EXIT_ERROR=1
@ -40,9 +41,10 @@ function msg_help {
echo -e "\nOptional control arguments:"
echo -e " -d, --dir DIR output path. Default: current dir, will be used as prefix of dir configured in config file"
echo -e " -b, --board FILE .kicad_pcb board file. Default: first board file found in current folder."
echo -e " -e, --schema FILE .sch schematic file. Default: first schematic file found in current folder."
echo -e " -b, --board FILE .kicad_pcb board file. Use __SCAN__ to get the first board file found in current folder."
echo -e " -e, --schema FILE .sch schematic file. Use __SCAN__ to get the first schematic file found in current folder."
echo -e " -s, --skip Skip preflights, comma separated or 'all'"
echo -e " -V, --variant Global variant"
echo -e "\nMiscellaneous:"
echo -e " -v, --verbose annotate program execution"
@ -110,16 +112,35 @@ function args_process {
CONFIG="$1"
;;
-b | --board ) shift
BOARD="-b $1"
if [ "$1" == "__SCAN__" ]; then
BOARD="-b "`ls -1 *.kicad_pcb | head -n1`
else
BOARD="-b $1"
fi
;;
-e | --schematic ) shift
SCHEMA="-e $1"
if [ "$1" == "__SCAN__" ]; then
SCHEMA="-e "`ls -1 *.*sch | head -n1`
else
SCHEMA="-e $1"
fi
;;
-V | --variant ) shift
if [ "$1" == "__NONE__" ]; then
VARIANT=""
else
VARIANT="-g variant=$1"
fi
;;
-d | --dir) shift
DIR="-d $1"
;;
-s | --skip) shift
SKIP="-s $1"
if [ "$1" == "__NONE__" ]; then
SKIP=""
else
SKIP="-s $1"
fi
;;
-v | --verbose) shift
if [ "$1" == "0" ]; then
@ -155,7 +176,7 @@ function run {
fi
if [ -f $CONFIG ]; then
kibot -c $CONFIG $DIR $BOARD $SCHEMA $SKIP $VERBOSE
kibot -c $CONFIG $DIR $BOARD $SCHEMA $SKIP $VERBOSE $VARIANT
else
echo "config file '$CONFIG' not found!"
exit $EXIT_ERROR