Update Master Cache #22
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: Update Master Cache | |
on: | |
schedule: | |
- cron: '0 2 * * 0' # As cache is emptied if not accessed for 7 days, check after 7 days whether container has changed | |
workflow_dispatch: | |
inputs: | |
build: | |
type: boolean | |
required: true | |
workflow_call: | |
inputs: | |
build: | |
type: boolean | |
required: true | |
env: | |
singularity_image: oras://ghcr.io/berenslab/retinal-rl:singularity-image | |
sif_file: retinal-rl_singularity-image.sif | |
jobs: | |
evaluate: | |
runs-on: ubuntu-latest | |
outputs: | |
build: ${{ steps.check.outputs.build }} | |
steps: | |
- name: Check inputs | |
id: check | |
run: | | |
if [[ "${{ inputs.build }}" != "" ]]; then | |
echo "build=${{ inputs.build }}" >> $GITHUB_OUTPUT | |
else | |
echo "build=${{ github.event_name == 'push' }}" >> $GITHUB_OUTPUT | |
fi | |
cache-or-build: | |
name: Build or pull container | |
needs: evaluate | |
if: needs.evaluate.outputs.build == 'true' | |
uses: ./.github/workflows/container_build.yml | |
cache-or-pull: | |
name: Cache or pull container | |
needs: evaluate | |
if: needs.evaluate.outputs.build == 'false' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Apptainer | |
uses: eWaterCycle/setup-apptainer@v2 | |
with: | |
apptainer-version: 1.3.0 | |
- name: Cache Singularity Image | |
id: cache-singularity | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.sif_file }} | |
key: ${{ runner.os }}-singularity-${{ hashFiles('resources/retinal-rl.def') }} | |
- name: Pull Singularity container | |
if: steps.cache-singularity.outputs.cache-hit != 'true' | |
run: apptainer pull ${{ env.sif_file }} ${{ env.singularity_image }} | |
- name: Show Versions | |
run: apptainer exec retinal-rl_singularity-image.sif pip freeze |