ARM-software / cmsis-actions

Custom GitHub actions for MDK / AVH-FVP CI workflows
https://arm-software.github.io/AVH/main/infrastructure/html/avh_gh_actions.html
Apache License 2.0
2 stars 2 forks source link

vcpkg action: can we avoid saving cache after each run? #2

Open VladimirUmek opened 4 months ago

VladimirUmek commented 4 months ago

Looking at the used cache key https://github.com/ARM-software/cmsis-actions/blob/f608f32a6d83e90d79e1f2bbb7812fdb94bf1679/vcpkg/action.yml#L26

I'm wondering whether we could get rid of _github.run_id? Using run_id_ as an end result, fills the cache storage. We could optimize this and use single cache entry until it is required to change it.

My initial idea was to check whether the content of vcpkg-configuration.json is changed by hashing it:

key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles( inputs.config ) }}${{ inputs.cache }}

This approach might not be fully accurate because at one of subsequent activations latest packages could be downloaded while vcpkg configuration still remains the same. I'm not sure whether we can overcome this limitation?

VladimirUmek commented 4 months ago

Note that separate cache save action is now available, see README.md

JonatanAntoni commented 4 months ago

Not sure if we could split the cache into separate Restore and Save actions to achieve this. The run_id part of the cache key might still be required because we still could have concurrent runs to Save the cache.

We'd just need to know if the cache requires update. We could try to inspect what vcpkg activate was doing. I.e., if it fetched and installed any new artifact (or version) the cache should be updated. In the same go, we could try to clean old versions from the cache before saving. This might need a bit of investigation work.