-
Notifications
You must be signed in to change notification settings - Fork 9
Cache downloaded swift packages #676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
3bd15d5 to
8ab0b0e
Compare
| run: cp BeeKit/Config.swift.sample BeeKit/Config.swift | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: /Users/runner/work/BeeSwift/BeeSwift/DerivedData/SourcePackages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/actions/cache/blob/main/examples.md#swift---swift-package-manager
Shows how to use it for typical setups:
- uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://stackoverflow.com/questions/68081067/spm-cache-not-working-on-github-actions-any-ideas suggests that is true if you are using swift package directly, but not if the resolution is being done by xcodebuild, as is being done here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so we specify cloned_source_packages_path in scan/run_tests and replace path: .build with the path specified in run_tests' cloned_source_packages_path parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looks like specifying derived_data_path also works. Do you have strong opinions on which is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I lean toward the cloned source option rather than the entire derived data. It seems more precisely targeted to what we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it seems CI does not take long at all to grab the spm managed packages currently.
11:55:31
11:54:58
🤞 the direct cache would be faster. It probably would be more efficient in any case.
Summary
Speed up CI by using the cache action to save packages downloaded by SPM.
Validation
Verify this PR runs CI, and then uses cache the second time.