hpc-module #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: hpc-module | |
on: | |
workflow_dispatch: | |
inputs: | |
module-name: | |
description: 'Module name' | |
required: true | |
type: string | |
module-tag: | |
description: 'Module tag' | |
required: false | |
default: 'NOT_DEFINED' | |
type: string | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
install_module: | |
runs-on: [hpc] | |
steps: | |
- uses: ecmwf-actions/reusable-workflows/ci-hpc-generic@v2 | |
with: | |
troika_user: ${{ secrets.HPC_CI_SSH_USER }} | |
template: | | |
MODULE_VERSION=${{ github.event_name == 'workflow_dispatch' && inputs.module-name || github.ref_name }} | |
MODULE_TAG=${{ github.event_name == 'workflow_dispatch' && inputs.module-tag || 'default'}} | |
HAT_BRANCH=${{ github.ref_name }} | |
PREFIX=/usr/local/apps/hat/${MODULE_VERSION} | |
rm -rf $PREFIX | |
mkdir -p $PREFIX | |
# Load the default python module | |
module load python3 | |
PYTHONUSERBASE=$PREFIX pip3 install --user git+https://github.com/ecmwf/hat.git@${HAT_BRANCH} | |
HAT_VERSION=$(PYTHONPATH=$PYTHONPATH:$PREFIX python3 -c 'import hat; print(hat._version.__version__)') | |
module unload python3 | |
cat > $PREFIX/README.txt << EOF | |
-- [hat] ($HAT_VERSION) [$HAT_VERSION] | |
EOF | |
software-sync -s local -p hat | |
module load modulemgr | |
modulemgr -f -m all sync hat | |
if [ $MODULE_TAG != 'NOT_DEFINED' ] | |
then | |
modulemgr -f -o -m all tag hat $MODULE_VERSION $MODULE_TAG | |
fi | |
sbatch_options: | | |
#SBATCH --job-name=cd_hat | |
#SBATCH --time=00:10:00 | |
#SBATCH --qos=deploy |