ci: Introduce caching for FIPS and macOS
Both the macOS and FIPS jobs don't use build caches. As a result they spend quite a while on re-building everything.
Improve CI build for those jobs by enabling caches in a pull-push configuration. This speeds up the macOS job from about 45 minutes to 35 minutes.
Edited by Patrick Steinhardt