From: Wei Liu Date: Thu, 28 Feb 2019 12:50:02 +0000 (+0000) Subject: automation: add a script to build newly pushed commits in Gitlab CI X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2367^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1ba432fb73f1437f27aae53486091a2b9d73df9a;p=xen.git automation: add a script to build newly pushed commits in Gitlab CI Signed-off-by: Wei Liu Acked-by: Doug Goldstein --- diff --git a/automation/gitlab-ci/build-each-commit.sh b/automation/gitlab-ci/build-each-commit.sh new file mode 100755 index 0000000000..6b7998448a --- /dev/null +++ b/automation/gitlab-ci/build-each-commit.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# For a newly pushed branch the BEFORE_SHA will be all 0s +if [[ ${CI_COMMIT_BEFORE_SHA} == 0000000000000000000000000000000000000000 ]]; then + echo "Newly pushed branch, skipped" + exit 0 +fi + +git merge-base --is-ancestor ${CI_COMMIT_BEFORE_SHA} ${CI_COMMIT_SHA} +if [[ $? -ne 0 ]]; then + echo "${CI_COMMIT_SHA} is not a descendent of ${CI_COMMIT_BEFORE_SHA}, skipped" + exit 0 +fi + +NON_SYMBOLIC_REF=1 ./automation/scripts/build-test.sh ${CI_COMMIT_BEFORE_SHA} ${CI_COMMIT_SHA} \ + bash -c "make -j4 distclean && ./automation/scripts/build"