Automatically append the OS architecture to the cache key
We had a user report as part of our Ubuntu arm64 rollout that tracked back to the apt package cache accidentally being shared between the x64 runners and arm64 runners. This resulted in some odd errors.
https://github.com/community/maintainers/discussions/480#discussioncomment-12206804
This change will add the CPU architecture to the key to be hashed.
I am not adding it if it is current "normal" case of x86_64 for ubuntu-latest, ubuntu-24.04, and ubuntu-22.04 in an effort to not needlessly invalidate caches.
Normalizing package list...
done
Validating action arguments (version='', packages='libfuse2=2.9.9-5ubuntu3 libqcustomplot-dev=2.0.1+dfsg1-5 libqscintilla2-qt5-dev=2.11.6+dfsg-4 libqt5svg5=5.15.3-1 ninja-build=1.10.1-1 qttools5-dev=5.15.3-1')...
done
Creating cache key...
- CPU architecture is 'x86_64'.
- Value to hash is 'libfuse2=2.9.9-5ubuntu3 libqcustomplot-dev=2.0.1+dfsg1-5 libqscintilla2-qt5-dev=2.11.6+dfsg-4 libqt5svg5=5.15.3-1 ninja-build=1.10.1-1 qttools5-dev=5.15.3-1 @ 3'.
- Value hashed as '7249e230c6406f49de3a7775bbe7ded2'.
done
Hash value written to /home/runner/cache-apt-pkgs/cache_key.md5
Run actions/cache/restore@v4
Cache not found for input keys: cache-apt-pkgs_7249e230c6406f49de3a7775bbe7ded2
Run ${GITHUB_ACTION_PATH}/post_cache_action.sh \
Updating APT package list...
done
Normalizing package list...
done
Validating action arguments (version='', packages='libfuse2=2.9.9-5ubuntu3 libqcustomplot-dev=2.0.1+dfsg1-5 libqscintilla2-qt5-dev=2.11.6+dfsg-4 libqt5svg5=5.15.3-1 ninja-build=1.10.1-1 qttools5-dev=5.15.3-1')...
done
Creating cache key...
- CPU architecture is 'aarch64'.
- Architecture 'aarch64' added to value.
- Value to hash is 'libfuse2=2.9.9-5ubuntu3 libqcustomplot-dev=2.0.1+dfsg1-5 libqscintilla2-qt5-dev=2.11.6+dfsg-4 libqt5svg5=5.15.3-1 ninja-build=1.10.1-1 qttools5-dev=5.15.3-1 @ 3 aarch64'.
- Value hashed as '62b41aa5465640843bc389516657d8f0'.
done
Hash value written to /home/runner/cache-apt-pkgs/cache_key.md5
Run actions/cache/restore@v4
Cache not found for input keys: cache-apt-pkgs_62b41aa5465640843bc389516657d8f0
Run ${GITHUB_ACTION_PATH}/post_cache_action.sh \
Updating APT package list...
done
https://github.com/mitesch/sqlitebrowser/actions/runs/13419146946
Here's an example run using my branch
Looks good, I'd like to add this to the CI as well @ https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions
Can you issue a PR for a test, I will approve and then we can run against this. Especially since this is a master PR.
Is this going to be merged at some point? I think my tests are failing due to cache being shared between archs here https://github.com/fenio/pv-mounter/actions/runs/15924537506
Changes now available in https://github.com/awalsh128/cache-apt-pkgs-action/releases/tag/v1.5.2