tools/ci.sh: Ensure enough commits are fetched for a common ancestor.
This commit updates the ci script to automatically fetch all upstream if the common commit hasn't been found; this should preserve the speed of CI checks for most PR's, and use a reliable but slow fetch if needed for older ones. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
This commit is contained in:
parent
9f835df35e
commit
d2a9d70c09
|
@ -45,6 +45,8 @@ function ci_code_spell_run {
|
||||||
function ci_commit_formatting_run {
|
function ci_commit_formatting_run {
|
||||||
git remote add upstream https://github.com/micropython/micropython.git
|
git remote add upstream https://github.com/micropython/micropython.git
|
||||||
git fetch --depth=100 upstream master
|
git fetch --depth=100 upstream master
|
||||||
|
# If the common ancestor commit hasn't been found, fetch more.
|
||||||
|
git merge-base upstream/master HEAD || git fetch --unshallow upstream master
|
||||||
# For a PR, upstream/master..HEAD ends with a merge commit into master, exclude that one.
|
# For a PR, upstream/master..HEAD ends with a merge commit into master, exclude that one.
|
||||||
tools/verifygitlog.py -v upstream/master..HEAD --no-merges
|
tools/verifygitlog.py -v upstream/master..HEAD --no-merges
|
||||||
}
|
}
|
||||||
|
@ -68,6 +70,8 @@ function ci_code_size_build {
|
||||||
git checkout -b pull_request # save the current location
|
git checkout -b pull_request # save the current location
|
||||||
git remote add upstream https://github.com/micropython/micropython.git
|
git remote add upstream https://github.com/micropython/micropython.git
|
||||||
git fetch --depth=100 upstream master
|
git fetch --depth=100 upstream master
|
||||||
|
# If the common ancestor commit hasn't been found, fetch more.
|
||||||
|
git merge-base upstream/master HEAD || git fetch --unshallow upstream master
|
||||||
# build reference, save to size0
|
# build reference, save to size0
|
||||||
# ignore any errors with this build, in case master is failing
|
# ignore any errors with this build, in case master is failing
|
||||||
git checkout `git merge-base --fork-point upstream/master pull_request`
|
git checkout `git merge-base --fork-point upstream/master pull_request`
|
||||||
|
|
Loading…
Reference in New Issue