[GHA] Added mechanism to cache 3D models

This commit is contained in:
Salvador E. Tropea 2023-01-27 16:37:57 -03:00
parent 039d94a85e
commit 21f51904fe
2 changed files with 13 additions and 0 deletions

View File

@ -51,11 +51,16 @@ inputs:
description: 'Additional arguments to pass to KiBot'
required: false
default: ''
cache3D:
description: 'Cache the 3D models, use YES [default: NO]'
required: false
default: 'NO'
runs:
using: 'docker'
image: Dockerfile
args:
- -c ${{ inputs.config }}
- -C ${{ inputs.cache3D }}
- -d ${{ inputs.dir }}
- -b ${{ inputs.board }}
- -e ${{ inputs.schema }}

View File

@ -13,6 +13,7 @@ VARIANT=""
TARGETS=""
QUICKSTART="NO"
INSTALL3D="NO"
CACHE3D="NO"
EXTRA_ARGS=""
# Exit error code
@ -39,6 +40,7 @@ function msg_illegal_arg {
function msg_help {
echo -e "\nOptional control arguments:"
echo -e " '-c FILE' .kibot.yaml config file"
echo -e " '-C YES' cache the 3D models."
echo -e " '-d DIR' output path. Default: current dir, will be used as prefix of dir configured in config file"
echo -e " '-b FILE' .kicad_pcb board file. Use __SCAN__ to get the first board file found in current folder."
echo -e " '-e FILE' .sch schematic file. Use __SCAN__ to get the first schematic file found in current folder."
@ -129,6 +131,8 @@ function args_process {
;;
-i) INSTALL3D="$VAL"
;;
-C) CACHE3D="$VAL"
;;
-s) if [ "$VAL" == "__NONE__" ]; then
SKIP=""
else
@ -169,6 +173,10 @@ function run {
/usr/bin/kicad_3d_install.sh
fi
if [ $CACHE3D == "YES" ]; then
export KIBOT_3D_MODELS="$HOME/cache_3d"
fi
if [ $QUICKSTART == "YES" ]; then
echo Quick-start options: $VERBOSE --quick-start
/bin/bash -c "kibot $VERBOSE --quick-start"