2023-11-18 07:30:06 +00:00
name : Check Cache
on :
workflow_call :
inputs :
os :
required : true
type : string
arch :
required : false
type : string
build-deps-only :
required : false
type : boolean
jobs :
check_cache : # determines if there is a cache and outputs variables used in caching process
name : Check Cache
runs-on : ${{ inputs.os }}
outputs :
cache-key : ${{ steps.set_outputs.outputs.cache-key }}
cache-path : ${{ steps.set_outputs.outputs.cache-path }}
valid-cache : ${{ steps.cache_deps.outputs.cache-hit }}
steps :
- name : Checkout
2024-03-10 14:45:35 +00:00
uses : actions/checkout@v4
2024-03-11 15:01:42 +00:00
with :
lfs : 'true'
2023-11-18 07:30:06 +00:00
- name : set outputs
id : set_outputs
env :
2024-06-25 15:24:39 +00:00
underscore-arch : ${{ inputs.os == 'macos-14' && '_' || ''}}${{ inputs.os == 'macos-14' && inputs.arch || '' }} # if is macos, make a string that does "_{arch}", else output nothing
dash-arch : ${{ inputs.os == 'macos-14' && '-' || ''}}${{ inputs.os == 'macos-14' && inputs.arch || '' }} # if is macos, make a string that does "-{arch}", else output nothing
dep-folder-name : ${{ (inputs.os == 'windows-latest' || inputs.os == 'macos-14') && 'OrcaSlicer_dep' || 'destdir' }}
2023-11-18 07:30:06 +00:00
output-cmd : ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}}
run : |
2024-06-25 15:24:39 +00:00
echo cache-key=${{ inputs.os }}${{ env.dash-arch }}-cache-orcaslicer_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }}
2023-11-18 07:30:06 +00:00
echo cache-path=${{ github.workspace }}/deps/build${{ env.underscore-arch }}/${{ env.dep-folder-name }}${{ env.underscore-arch }} >> ${{ env.output-cmd }}
- name : load cache
id : cache_deps
2024-03-10 14:45:35 +00:00
uses : actions/cache@v4
2023-11-18 07:30:06 +00:00
with :
path : ${{ steps.set_outputs.outputs.cache-path }}
key : ${{ steps.set_outputs.outputs.cache-key }}
lookup-only : true
build_deps : # call next step
name : Build Deps
needs : [ check_cache]
uses : ./.github/workflows/build_deps.yml
with :
cache-key : ${{ needs.check_cache.outputs.cache-key }}
cache-path : ${{ needs.check_cache.outputs.cache-path }}
valid-cache : ${{ needs.check_cache.outputs.valid-cache == 'true' }}
os : ${{ inputs.os }}
arch : ${{ inputs.arch }}
2023-11-19 04:12:01 +00:00
build-deps-only : ${{ inputs.build-deps-only }}
secrets : inherit