From 21f51904fea704ffe13e98bc819be80ee6a1fae1 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 27 Jan 2023 16:37:57 -0300 Subject: [PATCH] [GHA] Added mechanism to cache 3D models --- action.yml | 5 +++++ entrypoint.sh | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/action.yml b/action.yml index 53ab9bb9..fc3431ee 100644 --- a/action.yml +++ b/action.yml @@ -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 }} diff --git a/entrypoint.sh b/entrypoint.sh index 7347c42a..54986073 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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"