@@ -146,6 +146,23 @@ jobs:
146146 permissions :
147147 contents : write # Upload assets to release.
148148 steps :
149+ # Canonicalize inputs (which could come from workflow_dispatch or workflow_call)
150+ # which may be slightly different. E.g., change `true` to `ON` or `Release` to
151+ # `release`. This guarantees that we get cache hits regardless of input casing.
152+ - name : Canonicalize inputs
153+ id : canonicalize
154+ shell : bash
155+ run : |
156+ on_off() { case "${1,,}" in on|true) echo "ON" ;; *) echo "OFF" ;; esac; }
157+ echo "cmake_build_type=${INPUT_BUILD_TYPE,,}" >> $GITHUB_OUTPUT
158+ echo "cmake_c_compiler=${INPUT_COMPILER,,}" >> $GITHUB_OUTPUT
159+ echo "build_shared_libs=$(on_off "${INPUT_SHARED}")" >> $GITHUB_OUTPUT
160+ echo "llvm_enable_assertions=$(on_off "${INPUT_ASSERTIONS}")" >> $GITHUB_OUTPUT
161+ env :
162+ INPUT_BUILD_TYPE : ${{ inputs.cmake_build_type }}
163+ INPUT_COMPILER : ${{ inputs.cmake_c_compiler }}
164+ INPUT_SHARED : ${{ inputs.build_shared_libs }}
165+ INPUT_ASSERTIONS : ${{ inputs.llvm_enable_assertions }}
149166 - name : Clone llvm/circt
150167 uses : actions/checkout@v3
151168 with :
@@ -263,9 +280,7 @@ jobs:
263280 pip install pycapnp psutil pybind11==2.11.2 nanobind==2.9.2 numpy jinja2 cocotb~=1.9 cocotb_test~=0.2 click
264281
265282 echo cmake="-DMLIR_ENABLE_BINDINGS_PYTHON=ON -DCIRCT_BINDINGS_PYTHON_ENABLED=ON" >> "$GITHUB_OUTPUT"
266- # Setup Caching. Canonicalize inputs (which could come from workflow_dispatch
267- # or workflow_call) and may be slightly different. E.g., change `true` to `ON`.
268- # This will guarantee that we get cache hits.
283+ # Setup Caching.
269284#
270285# Caching has several constraints:
271286#
@@ -276,24 +291,17 @@ jobs:
276291# Taken together, disable caching on non-release builds.
277292#
278293# [1]: https://gitlab.kitware.com/cmake/cmake/-/issues/22529
279- - name : Canonicalize inputs
280- id : canonicalize
281- shell : bash
282- run : |
283- on_off() { case "${1,,}" in on|true) echo "ON" ;; *) echo "OFF" ;; esac; }
284- echo "build_shared_libs=$(on_off '${{ inputs.build_shared_libs }}')" >> $GITHUB_OUTPUT
285- echo "llvm_enable_assertions=$(on_off '${{ inputs.llvm_enable_assertions }}')" >> $GITHUB_OUTPUT
286294 - name : sccache
287- if : inputs .cmake_build_type == 'release'
295+ if : steps.canonicalize.outputs .cmake_build_type == 'release'
288296 uses : hendrikmuhs/ccache-action@v1.2
289297 with :
290- key : ${{ inputs.runner }}-${{ inputs. cmake_c_compiler }}-${{ inputs .cmake_build_type }}-${{ steps.canonicalize.outputs.build_shared_libs }}-${{ steps.canonicalize.outputs.llvm_enable_assertions }}
298+ key : ${{ inputs.runner }}-${{ steps.canonicalize.outputs. cmake_c_compiler }}-${{ steps.canonicalize.outputs .cmake_build_type }}-${{ steps.canonicalize.outputs.build_shared_libs }}-${{ steps.canonicalize.outputs.llvm_enable_assertions }}
291299 max-size : 500M
292300 variant : sccache
293301 save : ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
294302 - name : Configure sccache
295303 id : configure-sccache
296- if : inputs .cmake_build_type == 'release'
304+ if : steps.canonicalize.outputs .cmake_build_type == 'release'
297305 shell : bash
298306 run :
299307 echo enable_sccache="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_OUTPUT
0 commit comments