Description
Describe the feature
With shivammathur/setup-php#399, it becomes possible to install an extension from source, e.g. by specifying extensions: mongodb-mongodb/[email protected]
. The same works for commit hashes and branches, but this interferes with the caching.
Version
- I have checked releases and the feature is missing in the latest patch version of
v1
.
Underlying issue
This workflow caches the installed .so files for extensions and restores them before setup-php
is called. setup-php
then checks whether the restored version is correct and only installs the extension if there is a mismatch. This is done by running the equivalent of phpversion(<extension>)
, which can produce incorrect results when building from source. At a minimum, the cache needs to contain the version that was cached. This can take the form of <extension>-<version>
, with version
being either a version string or a full git hash. I don't think that the repository is needed to be part of this, as the commit hash should not conflict between different repos without actually pointing to the same content.
This process needs to take into account refs that may change, e.g. tags or branch refs. For this reason, whenever an extension is installed from source, the version identifier will always be a commit hash. This is to ensure that if version a.b.c was installed from pecl, this is not considered the same as installing tag a.b.c from a repository.
Describe alternatives
Additional context
Are you willing to submit a PR?
I plan to work on this next but wanted to discuss the approach before getting to work.