Skip to content

feat: use GitHub Actions cache to persist the CernVM-FS cache #37

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: cache
on:
push:
pull_request:
schedule:
- cron: '44 4 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
steps:
- uses: actions/checkout@v4
- run: mkdir -p ${{ github.workspace }}/.cvmfs
- uses: ./
with:
actions_cache: true
cvmfs_cache_base: ${{ github.workspace }}/.cvmfs
- name: Test CernVM-FS
run: |
source /cvmfs/sft.cern.ch/lcg/views/LCG_107/x86_64-ubuntu2404-gcc13-opt/setup.sh
root -l -q -b
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ inputs:
description: 'Location (directory) of the user-space apt cache.'
required: false
default: 'apt_cache'
actions_cache:
description: 'Enable a GitHub Actions cache for the CernVM cache.'
required: false
default: 'false'
cvmfs_alien_cache:
description: 'If set, use an alien cache at the given location.'
required: false
Expand Down Expand Up @@ -351,6 +355,12 @@ runs:
key: cvmfs-apt-cache-${{ steps.lsb-release.outputs.id-release }}-${{ steps.lsb-release.outputs.arch }}-${{ hashFiles('action.yml') }}
path: |
${{ inputs.apt_cache }}
- uses: actions/cache@v4
if: ${{ inputs.actions_cache == 'true' }}
with:
key: cvmfs-cache-${{ steps.lsb-release.outputs.id-release }}-${{ steps.lsb-release.outputs.arch }}-${{ hashFiles('action.yml') }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
key: cvmfs-cache-${{ steps.lsb-release.outputs.id-release }}-${{ steps.lsb-release.outputs.arch }}-${{ hashFiles('action.yml') }}
key: cvmfs-cache-${{ steps.lsb-release.outputs.id-release }}-${{ steps.lsb-release.outputs.arch }}

as seen in #40, using ${{ hashFiles('action.yml') }} as part of the key is not reliable as the file being hashed as very unlikely to appear in other repositories and causes caches to always miss.

path: |
${{ inputs.cvmfs_cache_base }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${{ inputs.cvmfs_cache_base }}
${{ inputs.cvmfs_cache_base }}

One further issue may be that the cache directory is used for a number of locks and marker files that we may not want to cache. I think in the end you only want to keep the actual data files in the hash directories ./00/ ... ./ff and maybe the ./cachedb file.

I'll test a few configurations to see what works best.

- run: |
${{ github.action_path }}/setup-cvmfs.sh
shell: bash
Expand Down
Loading