mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
tools/ci.sh: Return to old branch after code_size_build.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
committed by
Damien George
parent
7778e78843
commit
61988ee8fa
43
tools/ci.sh
43
tools/ci.sh
@@ -100,30 +100,33 @@ function ci_code_size_build {
|
||||
echo "Comparing sizes of reference ${REFERENCE} to ${COMPARISON}..."
|
||||
git log --oneline $REFERENCE..$COMPARISON
|
||||
|
||||
function code_size_build_step {
|
||||
COMMIT=$1
|
||||
OUTFILE=$2
|
||||
OLD_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
echo "Building ${COMMIT}..."
|
||||
git checkout --detach $COMMIT
|
||||
git submodule update --init $SUBMODULES
|
||||
git show -s
|
||||
tools/metrics.py clean $PORTS_TO_CHECK
|
||||
# Allow errors from tools/metrics.py to propagate out of the pipe above.
|
||||
(set -o pipefail; tools/metrics.py build $PORTS_TO_CHECK | tee $OUTFILE)
|
||||
return $?
|
||||
}
|
||||
( # Execute in a subshell so the trap & code_size_build_step doesn't leak
|
||||
function code_size_build_step {
|
||||
if [ ! -z "$OLD_BRANCH" ]; then
|
||||
trap 'git checkout "$OLD_BRANCH"' RETURN EXIT ERR
|
||||
fi
|
||||
|
||||
# build reference, save to size0
|
||||
# ignore any errors with this build, in case master is failing
|
||||
code_size_build_step $REFERENCE ~/size0
|
||||
# build PR/branch, save to size1
|
||||
code_size_build_step $COMPARISON ~/size1
|
||||
STATUS=$?
|
||||
COMMIT=$1
|
||||
OUTFILE=$2
|
||||
|
||||
unset -f code_size_build_step
|
||||
echo "Building ${COMMIT}..."
|
||||
git checkout --detach $COMMIT
|
||||
git submodule update --init $SUBMODULES
|
||||
git show -s
|
||||
tools/metrics.py clean "$PORTS_TO_CHECK"
|
||||
# Allow errors from tools/metrics.py to propagate out of the pipe below.
|
||||
set -o pipefail
|
||||
tools/metrics.py build "$PORTS_TO_CHECK" | tee $OUTFILE
|
||||
}
|
||||
|
||||
return $STATUS
|
||||
# build reference, save to size0
|
||||
# ignore any errors with this build, in case master is failing
|
||||
code_size_build_step $REFERENCE ~/size0
|
||||
# build PR/branch, save to size1
|
||||
code_size_build_step $COMPARISON ~/size1
|
||||
)
|
||||
}
|
||||
|
||||
function ci_code_size_report {
|
||||
|
||||
Reference in New Issue
Block a user