Skip to content

feat: make environment modification optional #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ inputs:
version:
description: "Version of toolchain or compiler"
required: false
update-environment:
description: "Whether to set environment variables"
required: false
default: true
outputs:
fc:
description: "Path to Fortran compiler"
Expand Down Expand Up @@ -72,9 +76,11 @@ runs:
cd $(echo '/${{ github.action_path }}' | sed -e 's/\\/\//g' -e 's/://')
source ./main.sh

echo "FC=${FC}" >> $GITHUB_ENV
echo "CC=${CC}" >> $GITHUB_ENV
echo "CXX=${CXX}" >> $GITHUB_ENV
if [[ "${{ inputs.update-environment }}" == "true" ]]; then
echo "FC=${FC}" >> $GITHUB_ENV
echo "CC=${CC}" >> $GITHUB_ENV
echo "CXX=${CXX}" >> $GITHUB_ENV
fi

# save oneAPI cache and activate environment
- name: Save cache
Expand Down Expand Up @@ -111,15 +117,16 @@ runs:
fi
fi

# set env vars
echo FC=$FC>>$GITHUB_ENV
echo CC=$CC>>$GITHUB_ENV
echo CXX=$CXX>>$GITHUB_ENV

# set fpm env vars
echo FPM_FC=$FC>>$GITHUB_ENV
echo FPM_CC=$CC>>$GITHUB_ENV
echo FPM_CXX=$CXX>>$GITHUB_ENV
if [[ "${{ inputs.update-environment }}" == "true" ]]; then
# cmake
echo FC=$FC>>$GITHUB_ENV
echo CC=$CC>>$GITHUB_ENV
echo CXX=$CXX>>$GITHUB_ENV
# fpm
echo FPM_FC=$FC>>$GITHUB_ENV
echo FPM_CC=$CC>>$GITHUB_ENV
echo FPM_CXX=$CXX>>$GITHUB_ENV
fi

# set action outputs
echo fc=$FC>>$GITHUB_OUTPUT
Expand Down
Loading