2018-02-13 09:47:47 +03:00
#!/bin/bash -e
2018-04-02 15:49:03 +03:00
report_error ( )
{
printf " 🔥 [Failed to compare API and create generator diff]( $BUILD_URL /console) 🔥\\n " >> $WORKSPACE /jenkins/pr-comments.md
2018-04-04 16:36:30 +03:00
touch $WORKSPACE /jenkins/failure-stamp
2018-05-25 12:36:59 +03:00
exit 0
2018-04-02 15:49:03 +03:00
}
trap report_error ERR
2018-02-13 09:47:47 +03:00
cd $WORKSPACE
2018-04-21 01:04:18 +03:00
2018-04-27 10:05:50 +03:00
if ./jenkins/fetch-pr-labels.sh --check= skip-api-comparison; then
printf "❎ Skipped API comparison because the PR has the label 'skip-api-comparison'\\n" >> $WORKSPACE /jenkins/pr-comments.md
exit 0
fi
2018-04-21 01:04:18 +03:00
BASE = origin/pr/$ghprbPullId /merge
if ! git rev-parse $BASE >/dev/null 2>& 1; then
echo " Can't compare API and create generator diff because the pull request has conflicts that must be resolved first (the branch ' $BASE ' doesn't exist). "
printf " 🔥 [Failed to compare API and create generator diff because the pull request has conflicts that must be resolved first]( $BUILD_URL /console) 🔥\\n " >> $WORKSPACE /jenkins/pr-comments.md
exit 0
fi
./tools/compare-commits.sh --base= $BASE ^1
2018-02-13 09:47:47 +03:00
mkdir -p jenkins-results/apicomparison
cp -R tools/comparison/apidiff/diff jenkins-results/apicomparison/
cp tools/comparison/apidiff/*.html jenkins-results/apicomparison/
cp -R tools/comparison/generator-diff jenkins-results/generator-diff
2018-04-02 15:49:03 +03:00
2018-05-24 16:04:14 +03:00
printf " ✅ [API Diff (from PR only)]( $BUILD_URL /API_20diff_20_28PR_20only_29)\\n " >> $WORKSPACE /jenkins/pr-comments.md
printf " ✅ [Generator Diff]( $BUILD_URL /Generator_20Diff)\\n " >> $WORKSPACE /jenkins/pr-comments.md