Skip to content

Conversation

@younke
Copy link

@younke younke commented Aug 10, 2022

Previous example is somewhat misleading.

When new package is added, old cache is being restored, which may lead to package resolve errors as described here.

Considering this guide:

To ensure the CI workflow’s reliability, make sure it uses the appropriate version of package dependencies.
SwiftPM records the result of dependency resolution in Package.resolved (at the top-level of the package) and it's used when performing dependency resolution (rather than having SwiftPM searching the latest eligible version of each package). Running swift package update updates all dependencies to the latest eligible versions and updates the Package.resolved. You can commit Package.resolved to your Git repository to ensure it’s always up-to-date on the CI environment to prevent the CI from building your project with unexpected versions of package dependencies. Otherwise you can choose to add Package.resolved file to .gitignore file and have swift package resolve command in charge of resolving the dependencies (swift package resolve is invoked by most SwiftPM commands).

We mustn't use restore-keys for spm cache.

@younke younke requested a review from a team as a code owner August 10, 2022 04:14
@github-actions github-actions bot requested a review from kotewar August 10, 2022 04:15
@kotewar kotewar added the documentation Improvements or additions to documentation label Sep 7, 2022
@kotewar
Copy link
Contributor

kotewar commented Sep 15, 2022

Hi @younke, thanks for your contribution. We have kept restore-key in examples for everyone to understand how the templates would look by default.

Your recommendation looks more like a good practice. Would you like to add a generic note instead in the Known practices and workarounds section?
The same thing would also apply to languages/frameworks like NodeJS, GoLang (for example), that maintain a similar resolved packages file package-lock.json or go.sum. So this note would help users having background in multiple technologies.

@kadoned
Copy link

kadoned commented Oct 16, 2022

  • name: Cache
    uses: actions/cache@v3.0.11
    - name: Cache
    uses: actions/cache@v3.0.11
    ``- name: Cache
    uses: actions/cache@v3.0.11

@kotewar
Copy link
Contributor

kotewar commented Oct 18, 2022

Closing this PR as there is no response. But to make this clearer, the readme will be updated by giving better insights on cache-hit and partial match restore-key. PR raised here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants