Skip to content

Instantly share code, notes, and snippets.

@m1entus
Created December 14, 2021 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m1entus/8449652b65d202e4e04c79a1a90d5276 to your computer and use it in GitHub Desktop.
Save m1entus/8449652b65d202e4e04c79a1a90d5276 to your computer and use it in GitHub Desktop.
restore_derived_data_from_develop:
steps:
# We need to perform git fetch in order to find nearest develop SHA
- run:
name: Git Fetch
command: git fetch --no-tags
# This will create file with nearest develop commit SHA usually this will be point from where we stared this cranch
# We need to store it to file just to be able to use it as a key inside `restore_cache` command.
# Because it is not possible to directly embed it inside {{ }}
- run:
name: Add nearest develop commit SHA environment variable
command: |
echo $(bash Scripts/nearest_develop_SHA.sh) > /tmp/nearest_dev_commit_sha
- restore_cache:
name: "Restore cache [Derived Data]"
keys:
- v1-derived-data-cache-{{ checksum "/tmp/nearest_dev_commit_sha" }}
- v1-derived-data-cache
# Extract our derived data from a tar file, if available. We need to tar in its own step
# to preserve permissions, use posix notation for higher-resolution timestamps, etc
- run:
name: Untar derived data
command: if [ -f dd-tar-cache/dd.tar ]; then tar xvPpf dd-tar-cache/dd.tar; else echo "No cache file"; fi
# It is expected behavior that file modification times will cause rebuilds. In Circle-CI, however,
# it may not be the modification times, but rather the device inode changes that are causing the derived data
# to be considered out of date.
# https://stackoverflow.com/questions/53753511/is-it-possible-to-copy-an-xcode-derived-data-cache
- run:
name: Set IgnoreFileSystemDeviceInodeChanges flag
command: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment