Skip to content

Include software versions in cache keys #295

@wrightak

Description

@wrightak

After submitting a support ticket, it was suggested I report this issue here.

I have a workflow that runs iOS tests, using caches for both Carthage and Cocoapods dependencies. For the Carthage dependencies, the cache key expression looks like this:

${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}

Recently a workflow failed with this error:

Module compiled with Swift 5.1.3 cannot be imported by the Swift 5.2.2 compiler

because the cache was used but the Swift version on the MacOS runner had been updated.

I believe that the solution to this is to include the Swift version in the cache key expression, just like runner.os and the hash of Cartfile.resolved. Running something like swift --version will output the version and I was thinking of using this in a step's output so that it could be read as input in the cache key but I understand that cache key expressions are evaluated before the workflow is executed.

So it would be great to either get access to the Swift version in a similar fashion to runner.os or to be able to use step outputs as inputs in the cache key expression.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions