Commit Graph

4 Commits

Author SHA1 Message Date
Jason Wray
fd73dea05e Handle >2 branches by switching to split[0] 2018-08-07 20:01:05 -04:00
Jason Wray
dfa7e37476 [build] Fix CI failure when master and release branch are identical
The search for branches containing the previous hash could return multiple matches on different lines, if, for instance, a newly-cut release branch were identical to master.
2018-08-07 15:11:00 -04:00
John Firebaugh
870d7fda4d [build] Attempt to determine a likely base branch without a PR
Walk backward through the history (maximum of 10 commits) until finding a commit on either master or release-*; assume that's the base branch.
2018-07-23 11:21:51 -07:00
John Firebaugh
74ef93ab4f [build] Improve ccache freshness
Save a fresh ccache on every build by including (a checksum of) the current revision in the cache key. In the worst case, saving the cache appears to take ~1:30 for android-release; other builds appear to take a small amount of time compared to the time saved by having a fresh cache, versus a cache that's up to a week old.

Restore caches in the following priority order (all scoped to current architecture and job):

1. The cache for the current branch and revision.

2. If that doesn't exist, the most recent cache for the current branch.

3. If that doesn't exist, the cache for the parent branch and merge base, where "parent branch" means the base branch of the pull request specified by $CIRCLE_PULL_REQUEST (obtained from the GitHub API), and "merge base" means the revision returned by `git merge-base` when given the parent branch and $CIRCLE_BRANCH (obtained by executing that shell command). The intent here is to start a newly created branch off with the most relevant cache from its parent branch.

4. If that doesn't exist, the most recent cache for the parent branch.

5. If that doesn't exist, the most recent cache for master.

6. If that doesn't exist, use the most recent cache for any build.

We cannot use the branch names or revisions themselves as key segments, because CircleCI lacks a way to interpolate arbitrary environment variables into the cache key name. Instead, we write the desired value into a file and use the `{{ checksum "filename" }}` syntax.
2018-07-13 11:50:39 -07:00