Skip to content

Commit

Permalink
setting up the inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Aug 29, 2024
1 parent f98897c commit 036303b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 45 deletions.
29 changes: 19 additions & 10 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
name: 'Install Plumed'
description: 'Installs plumed from https://github.com/plumed/plumed2'
# inputs:
# repository:
# suffix:
# version:
# program_name:
# who-to-greet: # id of input
# description: 'Who to greet'
# required: true
# default: 'World'
inputs:
repository:
description: 'The url of the Plumed repository'
required: false
default: 'https://github.com/plumed/plumed2.git'
suffix:
description: 'Suffix for the program name'
required: false
default: ''
version:
description: 'The version of plumed to install (default to master)'
required: false
default: 'master'
program_name:
# outputs:
# random-number:
# description: "Random number"
Expand All @@ -27,4 +32,8 @@ runs:
- name: Install plumed
run: $GITHUB_ACTION_PATH/install-plumed.sh
shell: bash

env:
SUFFIX: ${{ inputs.suffix }}
VERSION: ${{ inputs.version }}
PROGRAM_NAME: ${{ inputs.program_name }}
REPO: ${{ inputs.repository }}
74 changes: 39 additions & 35 deletions install-plumed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,47 @@
set -e
set -x

suffix=""
version=""
repo=https://github.com/plumed/plumed2.git
program_name=plumed
cat <<EOF
$SUFFIX
$VERSION
$REPO
$PROGRAM_NAME
EOF

for opt; do
case "$opt" in
version=*) version="${opt#version=}" ;;
suffix=*)
suffix="--program-suffix=${opt#suffix=}"
program_name="plumed${opt#suffix=}"
;;
repo=*) repo="${opt#repo=}" ;;
*)
echo "unknown option $opt"
exit 1
;;
esac
done
# for opt; do
# case "$opt" in
# version=*) version="${opt#version=}" ;;
# suffix=*)
# suffix="--program-suffix=${opt#suffix=}"
# program_name="plumed${opt#suffix=}"
# ;;
# REPO=*) REPO="${opt#REPO=}" ;;
# *)
# echo "unknown option $opt"
# exit 1
# ;;
# esac
# done

cd "$(mktemp -dt plumed.XXXXXX)" || {
echo "Failed to create tempdir"
exit 1
}

git clone $repo
git clone $REPO
cd plumed2

if [[ -n "$version" ]]; then
echo "installing plumed $version"
if [[ -n "$VERSION" ]]; then
echo "installing plumed $VERSION"
else
version=$(git tag --sort=version:refname |
VERSION=$(git tag --sort=version:refname |
grep '^v2\.[0-9][0-9]*\.[0-9][0-9]*' |
tail -n 1)
echo "installing latest stable plumed $version"
echo "installing latest stable plumed $VERSION"
fi

#cheking out to $version before compiling the dependency json for this $version
git checkout $version
#cheking out to $VERSION before compiling the dependency json for this $VERSION
git checkout $VERSION

if [[ $SETDEPENDENCIES ]]; then
# This gets all the dependency information in plumed
Expand Down Expand Up @@ -75,27 +77,29 @@ if [[ $SETDEPENDENCIES ]]; then
firstline=",\n"
done
echo -e '\n}'
} >"$GITHUB_WORKSPACE/_data/extradeps$version.json"
} >"$GITHUB_WORKSPACE/_data/extradeps$VERSION.json"
fi
hash=$(git rev-parse HEAD)

if [[ -f $HOME/opt/lib/$program_name/$hash ]]; then
if [[ -f $HOME/opt/lib/$PROGRAM_NAME/$hash ]]; then
echo "ALREADY AVAILABLE, NO NEED TO REINSTALL"
else

rm -fr "$HOME/opt/lib/$program_name"
rm -fr "$HOME/opt/bin/$program_name"
rm -fr "$HOME/opt/include/$program_name"
rm -fr "$HOME"/opt/lib/lib$program_name.so*

rm -fr "$HOME/opt/lib/$PROGRAM_NAME"
rm -fr "$HOME/opt/bin/$PROGRAM_NAME"
rm -fr "$HOME/opt/include/$PROGRAM_NAME"
rm -fr "$HOME"/opt/lib/lib$PROGRAM_NAME.so*
cat <<EOF
./configure --prefix="$HOME/opt" \
--enable-modules=all \
--enable-boost_serialization \
--enable-fftw $suffix \
--enable-fftw $SUFFIX \
--enable-libtorch LDFLAGS=-Wl,-rpath,$LD_LIBRARY_PATH
make -j 5
make install
touch "$HOME/opt/lib/$program_name/$hash"

touch "$HOME/opt/lib/$PROGRAM_NAME/$hash"
EOF
fi

0 comments on commit 036303b

Please sign in to comment.