ci: fix gcc version disambiguation in setup-deps

Use JSON output and jq to select the newest installed gcc version
when multiple versions match, avoiding conflicts between system and
spack-installed compilers.
This commit is contained in:
Dennis Klein
2025-12-01 09:03:12 +01:00
parent cd074a3f1e
commit 695ed89b6c

View File

@@ -36,7 +36,8 @@ runs:
run: | run: |
echo "::group::Install GCC" echo "::group::Install GCC"
spack install ${{ inputs.fresh == 'true' && '--fresh' || '' }} gcc@${{ inputs.gcc }} target=x86_64_v3 spack install ${{ inputs.fresh == 'true' && '--fresh' || '' }} gcc@${{ inputs.gcc }} target=x86_64_v3
spack compiler find $(spack location -i gcc@${{ inputs.gcc }}) gcc_hash=$(spack find --json gcc@${{ inputs.gcc }} target=x86_64_v3 | jq -r 'sort_by(.version | split(".") | map(tonumber)) | last | .hash')
spack compiler find "$(spack location -i /$gcc_hash)"
echo "::endgroup::" echo "::endgroup::"
- name: Install dependencies - name: Install dependencies