Did you manage to get the caching to improve the performance of your actions?
On a project I’ve been working on recently (to be open sourced soon hopefully), we were able to get our action times to drop from 30+minutes to 5minutes by making use of the cache.
I’ve included the relevant snippet from the action we used:
- name: Cache
id: cache-opam
uses: actions/cache@v3
env:
cache-name: cache-opam
with:
path: |
/home/runner/work/proof-repair/proof-repair/_opam/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.opam') }}
- name: Opam & Coq
if: steps.cache-opam.outputs.cache-hit != 'true'
run: |
opam repository add default https://github.com/ocaml/opam-repository.git --all-switches --set-default
opam repository add coq-released https://coq.inria.fr/opam/released --all-switches --set-default
- name: Install Dune
if: steps.cache-opam.outputs.cache-hit != 'true'
run: |
opam install dune
- name: Install
if: steps.cache-opam.outputs.cache-hit != 'true'
run: |
opam install . --deps-only
Actually, the hard work was done by an undergrad @mayank working with me, so I can’t really comment on whether this is actually a robust way of improving performance times.
I think the key step in reducing build times was to add the if check to the install steps to avoid running them when the cache was hit.