Skip to content

Commit

Permalink
Merge pull request #179 from uturuncoglu/hotfix/spack_build
Browse files Browse the repository at this point in the history
Remove fixed GCC version from Spack build action
  • Loading branch information
uturuncoglu authored Aug 14, 2023
2 parents 42d4814 + 4d88abf commit 4f34e71
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/scripts/spack_concretize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,29 @@ if [[ "$comp" == *"oneapi"* ]]; then
echo "::endgroup::"
fi

# check given gcc compiler is found or not? If not, use newer version
if [[ "$comp" == *"gcc"* ]]; then
echo "::group::Check gcc compiler"
comp_str=${comp/@/@=}
str=`echo $comp_str | awk -F\@ '{print $1}'`
comp_ver=`grep -ir "${str}@=" ~/.spack/linux/compilers.yaml | tr -d "spec: ${str}@=" | sort -n | tail -n 1`

use_latest=0
if [[ "$comp" == *"gcc@latest"* ]]; then
echo "The gcc@latest is set. Trying to find latest available gcc compiler ..."
use_latest=1
elif [ -z "$(cat ~/.spack/linux/compilers.yaml | grep $comp_str)" ]; then
echo "Given compiler ($comp) is not found! Exiting ..."
exit 1
fi

if [[ $use_latest == 1 ]]; then
comp="${str}@$comp_ver"
fi
echo "Using $comp gnu compiler."
echo "::endgroup::"
fi

# create spack.yaml
echo "::group::Create spack.yaml"
echo "spack:" > spack.yaml
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/test-build-spack.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: Build ESMF Using Spack

env:
compiler: gcc@11.3.0
compiler: gcc@latest
esmf_version: 'esmf@develop'
nuopc_app_version: 'develop'

on:
workflow_dispatch:
inputs:
compiler:
description: 'Compiler version like [email protected] or gcc@latest (latest available version on runner)'
required: false
type: string
default: 'gcc@latest'
esmf_version:
description: 'ESMF version or tag like esmf@develop or esmf@=8.5.0b23'
required: false
Expand Down Expand Up @@ -39,7 +44,11 @@ jobs:
echo "ENV : >${{ env.esmf_version }}< >${{ env.nuopc_app_version }}<"
# create matrix JSON file
str1="{\"compiler\": [\"${{ env.compiler }}\"],"
if [ -z "${{ inputs.compiler }}" ]; then
str1="{\"compiler\": [\"${{ env.compiler }}\"],"
else
str1="{\"compiler\": [\"${{ inputs.compiler }}\"],"
fi
if [ -z "${{ inputs.esmf_version }}" ]; then
str2="\"esmf\": [\"${{ env.esmf_version }}+external-parallelio\", \"${{ env.esmf_version }}~external-parallelio\"]}"
echo "nuopc_app_version=${{ env.nuopc_app_version }}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 4f34e71

Please sign in to comment.