From 5cd05dd2607eb10ad9b1e9536cd1739133c699c8 Mon Sep 17 00:00:00 2001 From: pdziekan Date: Fri, 5 Nov 2021 11:08:03 +0100 Subject: [PATCH] copy action from libcloudphxx workflow --- action.yml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..f3876e8 --- /dev/null +++ b/action.yml @@ -0,0 +1,51 @@ +name: 'load UWLCM Singularity image' +description: 'set env var SI to point to the image location' +inputs: + path: + description: 'Where to put the image' + required: true + tag: + description: 'Image tag' + required: true + default: 'ubuntu_20_04_cuda_11_4' + +runs: + using: "composite" + steps: + + - name: Install Singularity + #when installed from this action, .SIF is always converted to sandbox (could be related to: https://githubmemory.com/repo/hpcng/singularity/issues/6065) + uses: eWaterCycle/setup-singularity@v7 + with: + singularity-version: 3.8.3 + #apt installation following https://sylabs.io/guides/3.0/user-guide/installation.html, but this is a too old version and uninstalls python-is-python3 +# run: | +# wget -O- http://neuro.debian.net/lists/focal.de-fzj.libre | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list +# sudo apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9 +# sudo apt-get update +# sudo apt-get install -y singularity-container + + - name: Cache UWLCM Singularity image + id: cache_singularity + uses: actions/cache@v2 + with: + path: '${{ inputs.path }}/uwlcm_${{ inputs.tag }}.sif' + key: '${{ inputs.tag }}' + + - name: Download UWLCM Singularity image + shell: bash +# if: steps.cache_singularity.outputs.cache-hit != 'true' + run: | + [ "${{steps.cache_singularity.outputs.cache-hit}}" != "true" ] && \ + { + mkdir '${{ inputs.path }}'; + singularity pull --disable-cache --dir '${{ inputs.path }}' library://pdziekan/default/uwlcm:${{ inputs.tag }}; + } \ + || \ + true + # disable Singularity cache, we cache manually + + - name: Set friendly Singularity image name + uses: allenevans/set-env@v2.0.0 + with: + SI: '${{ inputs.path }}/uwlcm_${{ inputs.tag }}.sif'