mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-12-13 22:40:16 +00:00
Use JSON output and jq to select the newest installed gcc version when multiple versions match, avoiding conflicts between system and spack-installed compilers.
53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
name: Install dependencies
|
|
description: Setup spack and install dependencies
|
|
|
|
inputs:
|
|
gcc:
|
|
description: 'GCC version to use'
|
|
required: true
|
|
env:
|
|
description: 'Spack environment name (latest, boost187)'
|
|
default: 'latest'
|
|
fresh:
|
|
description: 'Use fresh concretization'
|
|
default: 'false'
|
|
|
|
runs:
|
|
using: composite
|
|
# Composite action step names are not shown in the UI (https://github.com/actions/runner/issues/1877),
|
|
# so we use ::group:: to make them visible.
|
|
steps:
|
|
- name: Setup spack
|
|
uses: spack/setup-spack@v2
|
|
with:
|
|
ref: v1.1.0
|
|
color: true
|
|
buildcache: true
|
|
|
|
- name: Find system compiler
|
|
shell: spack-bash {0}
|
|
run: |
|
|
echo "::group::Find system compiler"
|
|
spack compiler find
|
|
echo "::endgroup::"
|
|
|
|
- name: Install GCC
|
|
shell: spack-bash {0}
|
|
run: |
|
|
echo "::group::Install GCC"
|
|
spack install ${{ inputs.fresh == 'true' && '--fresh' || '' }} gcc@${{ inputs.gcc }} target=x86_64_v3
|
|
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::"
|
|
|
|
- name: Install dependencies
|
|
shell: spack-bash {0}
|
|
run: |
|
|
echo "::group::Install dependencies"
|
|
spack env create fairmq test/ci/spack-${{ inputs.env }}.yaml
|
|
spack -e fairmq add gcc@${{ inputs.gcc }}
|
|
spack -e fairmq config add "packages:all:require:'%gcc@${{ inputs.gcc }}'"
|
|
spack -e fairmq install --fail-fast ${{ inputs.fresh == 'true' && '--fresh' || '' }}
|
|
spack env activate --sh fairmq | grep '^export ' | sed 's/^export //;s/;$//' >> $GITHUB_ENV
|
|
echo "::endgroup::"
|