'How do you cache and retrieve swift packages using Azure Pipelines
I am trying to cache swift pacakages but I see a lot of examples doing the following below. This would only cache the package.resolved file but not necessarily the packages themselves. Also how do you retrieve the packages?
- task: Cache@2
inputs:
key: '"spm" | "$(Agent.OS)" | Package.resolved'
restoreKeys: |
spm | "$(Agent.OS)"
path: $(CACHE_FOLDER)
Solution 1:[1]
You can cache the package in the cache folder like following:
variables:
- name: SPM_FOLDER value: $(System.DefaultWorkingDirectory)/{project}.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
- name: CACHE_FOLDER value: $(Pipeline.Workspace)
steps:
- task: Cache@2
inputs:
key: '"spm" | "$(Agent.OS)" | "$(SPM_FOLDER)"'
restoreKeys: | spm | "$(Agent.OS)" path: $(CACHE_FOLDER)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kangcheng Jin-MSFT |