-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Re-enable API and Generator diff. (#11187)
Use the jenkins script as a base to get the PAI & generator from stable diff back to the CI. Comment is not perfect, but does provide the required information. The comment can be improve in a later commit since this is getting too large.
- Loading branch information
1 parent
e2d6552
commit 993c744
Showing
12 changed files
with
228 additions
and
107 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ macos-*.md | |
maccat-*.md | ||
xamarin-*.md | ||
*.stamp | ||
*.md.tmp | ||
bundle-*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/bash -e | ||
|
||
# | ||
# How to run API comparison locally: | ||
# | ||
# 1. To compare a specific commit to the previous one, just run this script (./compare.sh). | ||
# 2. Replicating what happens for a specific PR is a bit more complicated: | ||
# a. Fetch the source code for that PR, using "git fetch --no-tags --progress https://github.com/xamarin/xamarin-macios +refs/pull/<PR>/*:refs/remotes/origin/pr/<PR>/*", | ||
# so for example this for PR #4614: | ||
# | ||
# git fetch --no-tags --progress https://github.com/xamarin/xamarin-macios +refs/pull/4614/*:refs/remotes/origin/pr/4614/* | ||
# | ||
# b. Checkout the commit you want to compare (typically the branch you created the PR from if it's your own PR). | ||
# i) This isn't 100% accurate, since GitHub will build a merged version | ||
# of your branch + the target branch. If you want to test _exactly_ | ||
# the same code as GitHub, checkout the 'origin/pr/<merge>/merge' | ||
# branch the previous git fetch command created. | ||
# | ||
# c. Execute 'PR_ID=4614 ./compare.sh' | ||
# | ||
|
||
API_COMPARISON="$WORKSPACE/apicomparison" | ||
BUILD_URL="$SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$SYSTEM_TEAMPROJECT/_build/index?buildId=$BUILD_BUILDID&view=ms.vss-test-web.test-result-details" | ||
URL_PREFIX="$VSDROPSPREFIX/$BUILD_BUILDNUMBER/$BUILD_BUILDID/apigeneratordiff/;/" | ||
API_URL="$URL_PREFIX/api-diff.html" | ||
GENERATOR_URL="$URL_PREFIX/generator-diff/index.html" | ||
|
||
# env var should have been defined by the CI | ||
if test -z "$XAM_TOP"; then | ||
echo "Variable XAM_TOP is missing." | ||
exit 1 | ||
fi | ||
|
||
cd $XAM_TOP | ||
|
||
MARKDOWN_INDENT=" " | ||
echo "*** Comparing API & creating generator diff... ***" | ||
export COMPARE_FAILURE_FILE=$TMPDIR/api-diff-compare-failures.txt | ||
report_error () | ||
{ | ||
printf ":fire: [Failed to compare API and create generator diff](%s/console) :fire:\\n" "$BUILD_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
if test -f "$COMPARE_FAILURE_FILE"; then | ||
sed "s/^/${MARKDOWN_INDENT//&/\\&}/" "$COMPARE_FAILURE_FILE" >> "$WORKSPACE/api-diff-comments.md" | ||
fi | ||
printf "${MARKDOWN_INDENT}Search for \`Comparing API & creating generator diff\` in the log to view the complete log.\\n" >> "$WORKSPACE/api-diff-comments.md" | ||
touch "$WORKSPACE/failure-stamp" | ||
rm -f "$COMPARE_FAILURE_FILE" | ||
echo "*** Comparing API & creating generator diff failed ***" | ||
MESSAGE="*** Comparing API & creating generator diff failed ***" | ||
exit 0 | ||
} | ||
trap report_error ERR | ||
|
||
if test -z "$PR_ID"; then | ||
BASE=HEAD | ||
else | ||
BASE="origin/pr/$PR_ID/merge" | ||
fi | ||
|
||
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)." | ||
MESSAGE="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 ":fire: [Failed to compare API and create generator diff because the pull request has conflicts that must be resolved first](%s/console) :fire:\\n" "$BUILD_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
exit 0 | ||
fi | ||
|
||
./tools/compare-commits.sh --base="$BASE^1" "--failure-file=$COMPARE_FAILURE_FILE" | ||
|
||
mkdir -p "$API_COMPARISON" | ||
|
||
|
||
cp -R ./tools/comparison/apidiff/diff "$API_COMPARISON" | ||
cp ./tools/comparison/apidiff/*.html "$API_COMPARISON" | ||
cp -R ./tools/comparison/generator-diff "$API_COMPARISON" | ||
|
||
if ! grep "href=" "$API_COMPARISON/api-diff.html" >/dev/null 2>&1; then | ||
printf ":white_check_mark: [API Diff (from PR only)](%s) (no change)" "$API_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
elif perl -0777 -pe 's/<script type="text\/javascript">.*?<.script>/script removed/gs' "$API_COMPARISON/*.html" | grep data-is-breaking; then | ||
printf ":warning: [API Diff (from PR only)](%s) (:fire: breaking changes :fire:)" "$API_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
else | ||
printf ":information_source: [API Diff (from PR only)](%s) (please review changes)" "$API_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
fi | ||
printf "\\n" >> "$WORKSPACE/api-diff-comments.md" | ||
|
||
if ! test -s $API_COMPARISON/generator-diff/generator.diff; then | ||
printf ":white_check_mark: [Generator Diff](%s) (no change)" "$GENERATOR_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
elif grep "^[+-][^+-]" $API_COMPARISON/generator-diff/generator.diff | grep -v "^.[[]assembly: AssemblyInformationalVersion" | grep -v "^[+-][[:space:]]*internal const string Revision =" >/dev/null 2>&1; then | ||
printf ":information_source: [Generator Diff](%s) (please review changes)" "$GENERATOR_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
else | ||
printf ":white_check_mark: [Generator Diff](%s) (only version changes)" "$GENERATOR_URL" >> "$WORKSPACE/api-diff-comments.md" | ||
fi | ||
printf "\\n" >> "$WORKSPACE/api-diff-comments.md" | ||
|
||
cp "$WORKSPACE/api-diff-comments.md" "$API_COMPARISON" | ||
if test -f "$COMPARE_FAILURE_FILE"; then | ||
cp "$COMPARE_FAILURE_FILE" "$API_COMPARISON" | ||
fi | ||
MESSAGE="*** Comparing API & creating generator diff completed ***" | ||
echo "##vso[task.setvariable variable=API_GENERATOR_DIFF_MESSAGE;isOutput=true]$MESSAGE" | ||
echo "##vso[task.setvariable variable=API_GENERATOR_BUILT;isOutput=true]True" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash -e | ||
# | ||
# How to run API comparison locally: | ||
# | ||
# 1. To compare a specific commit to the previous one, just run this script (./compare.sh). | ||
# 2. Replicating what happens for a specific PR is a bit more complicated: | ||
# a. Fetch the source code for that PR, using "git fetch --no-tags --progress https://github.com/xamarin/xamarin-macios +refs/pull/<PR>/*:refs/remotes/origin/pr/<PR>/*", | ||
# so for example this for PR #4614: | ||
# | ||
# git fetch --no-tags --progress https://github.com/xamarin/xamarin-macios +refs/pull/4614/*:refs/remotes/origin/pr/4614/* | ||
# | ||
# b. Checkout the commit you want to compare (typically the branch you created the PR from if it's your own PR). | ||
# i) This isn't 100% accurate, since GitHub will build a merged version | ||
# of your branch + the target branch. If you want to test _exactly_ | ||
# the same code as GitHub, checkout the 'origin/pr/<merge>/merge' | ||
# branch the previous git fetch command created. | ||
# | ||
# c. Execute 'ghprbPullId=4614 ./compare.sh' | ||
# | ||
|
||
# set needed env vars, call the actual script | ||
cd "$(dirname "${BASH_SOURCE[0]}")/../../../../.." | ||
export WORKSPACE=$(pwd) | ||
export XAM_TOP="$WORKSPACE" | ||
|
||
./tools/devops/automation/scripts/bash/compare.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash -e | ||
# set the env vars that are required for the compare to work. XAM_TOP is not set because | ||
# the yaml takes care of that. | ||
export WORKSPACE="$BUILD_ARTIFACTSTAGINGDIRECTORY" | ||
echo "GH PR: $PR_ID" | ||
cd $XAM_TOP | ||
|
||
if [[ $PR_ID ]]; then | ||
git fetch --no-tags --progress https://github.com/xamarin/xamarin-macios +refs/pull/$PR_ID/*:refs/remotes/origin/pr/$PR_ID/* | ||
fi | ||
|
||
|
||
./tools/devops/automation/scripts/bash/compare.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
993c744
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Tests failed on Build ❌
Tests failed on Build.
API diff
✅ API Diff from stable
View API diff
API & Generator diff
✅ API Diff (from PR only) (no change)
✅ Generator Diff (no change)
Packages generated
View packages
Test results
9 tests failed, 184 tests passed.
Failed tests
Pipeline on Agent XAMBOT-1017
[CI] Re-enable API and Generator diff. (#11187)
993c744
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[CI] Re-enable API and Generator diff. (#11187)
993c744
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[CI] Re-enable API and Generator diff. (#11187)
993c744
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Tests failed on macOS Mac Mojave (10.14) ❌
Tests failed on Mac Mojave (10.14).
Failed tests are:
Pipeline on Agent
[CI] Re-enable API and Generator diff. (#11187)
993c744
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Tests failed on macOS Mac High Sierra (10.13) ❌
Tests failed on Mac High Sierra (10.13).
Failed tests are:
Pipeline on Agent
[CI] Re-enable API and Generator diff. (#11187)
993c744
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[CI] Re-enable API and Generator diff. (#11187)