Skip to content

Commit

Permalink
azdevops: xamarin#70.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Apr 4, 2019
1 parent e7f4427 commit 835b28d
Showing 1 changed file with 41 additions and 36 deletions.
77 changes: 41 additions & 36 deletions tools/devops/build-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
Debug|Mac:
TEST_PLATFORM_FILTER_EXPRESSION: $(mac_platform_filter)
TEST_CONFIG_FILTER_EXPRESSION: $(debug_filter)
ReleaseMac:
Release|Mac:
TEST_PLATFORM_FILTER_EXPRESSION: $(mac_platform_filter)
TEST_CONFIG_FILTER_EXPRESSION: $(release_filter)

Expand Down Expand Up @@ -140,52 +140,57 @@ jobs:
pool:
vmImage: 'macOS-10.13'
variables:
jobResultDebugiPhoneAF: $[dependencies.macOS.outputs['Debug|iPhone|A-F.ExportedVariables.JobStatus']]
jobResultDebugiPhoneGR: $[dependencies.macOS.outputs['Debug|iPhone|G-R.ExportedVariables.JobStatus']]
jobResultDebugiPhoneSZ: $[dependencies.macOS.outputs['Debug|iPhone|S-Z.ExportedVariables.JobStatus']]
jobResultDebugiPhoneSimulator: $[dependencies.macOS.outputs['Debug|iPhoneSimulator.ExportedVariables.JobStatus']]
jobResultReleaseiPhoneAF: $[dependencies.macOS.outputs['Release|iPhone|A-F.ExportedVariables.JobStatus']]
jobResultReleaseiPhoneGR: $[dependencies.macOS.outputs['Release|iPhone|G-R.ExportedVariables.JobStatus']]
jobResultReleaseiPhoneSZ: $[dependencies.macOS.outputs['Release|iPhone|S-Z.ExportedVariables.JobStatus']]
jobResultReleaseiPhoneSimulator: $[dependencies.macOS.outputs['Release|iPhoneSimulator.ExportedVariables.JobStatus']]
jobResultDebugiPhoneAF: $[ dependencies.macOS.outputs['Debug|iPhone|A-F.ExportedVariables.JobStatus'] ]
jobResultDebugiPhoneGR: $[ dependencies.macOS.outputs['Debug|iPhone|G-R.ExportedVariables.JobStatus'] ]
jobResultDebugiPhoneSZ: $[ dependencies.macOS.outputs['Debug|iPhone|S-Z.ExportedVariables.JobStatus'] ]
jobResultDebugiPhoneSimulator: $[ dependencies.macOS.outputs['Debug|iPhoneSimulator.ExportedVariables.JobStatus'] ]
jobResultReleaseiPhoneAF: $[ dependencies.macOS.outputs['Release|iPhone|A-F.ExportedVariables.JobStatus'] ]
jobResultReleaseiPhoneGR: $[ dependencies.macOS.outputs['Release|iPhone|G-R.ExportedVariables.JobStatus'] ]
jobResultReleaseiPhoneSZ: $[ dependencies.macOS.outputs['Release|iPhone|S-Z.ExportedVariables.JobStatus'] ]
jobResultReleaseiPhoneSimulator: $[ dependencies.macOS.outputs['Release|iPhoneSimulator.ExportedVariables.JobStatus'] ]
jobResultDebugMac: $[ dependencies.macOS.outputs['Debug|Mac.ExportedVariables.JobStatus'] ]
jobResultReleaseMac: $[ dependencies.macOS.outputs['Release|Mac.ExportedVariables.JobStatus'] ]
jobResultDummy: hello
jobResultDummy2: $[dependencies.macOS.outputs['ReleaseMac.ExportedVariables.JobStatus']]

steps:
- bash: |
set -x
set -e
env | sort
statuses="JOBRESULTDEBUGIPHONEAF JOBRESULTDEBUGIPHONEGR JOBRESULTDEBUGIPHONESZ JOBRESULTDEBUGIPHONESIMULATOR JOBRESULTRELEASEIPHONEAF JOBRESULTRELEASEIPHONEGR JOBRESULTRELEASEIPHONESZ JOBRESULTRELEASEIPHONESIMULATOR JOBRESULTDEBUGMAC JOBRESULTRELEASEMAC"
EMOJI=
STEPS="$STEPS Debug|iPhone|A-F"
STEPS="$STEPS Debug|iPhone|G-R"
STEPS="$STEPS Debug|iPhone|S-Z"
STEPS="$STEPS Debug|iPhoneSimulator"
STEPS="$STEPS Release|iPhone|A-F"
STEPS="$STEPS Release|iPhone|G-R"
STEPS="$STEPS Release|iPhone|S-Z"
STEPS="$STEPS Release|iPhoneSimulator"
STEPS="$STEPS Debug|Mac"
STEPS="$STEPS Release|Mac"
EMOJII="✅"
STATUS=
GH_STATE=
for name in $statuses; do
status=${!name}
if ! [[ "$status" =~ Succeeded* ]]; then
GH_STATE=success
FILE=commit-comment.md
AZURE_BUILD_URL="${SYSTEM_COLLECTIONURI}/${SYSTEM_TEAMPROJECT}/_build/results?buildId=${BUILD_BUILDID}"
for STEP in $STEPS; do
STEPNAME=JOBRESULT$(echo "$STEP" | tr a-z A-Z | sed -e 's/|//' -e 's/-//')
STEPSTATUS=${!STEPNAME}
if [[ "$STEPSTATUS" == "Succeeded" ]]; then
STEPEMOJII="✅"
else
STEPEMOJII="❌"
EMOJII="❌"
GH_STATE=failure
STATUS="$status"
elif [[ "$status" == "SucceededWithIssues" && "$EMOJII" == "" ]]; then
EMOJII="⚠️"
GH_STATE=failure
STATUS="$status"
fi
done
if [[ "$EMOJII" == "" ]]; then
EMOJII="✅"
GH_STATE=success
STATUS=Succeeded
fi
if [[ "$STATUS" == "" ]]; then
STATUS="Failed"
echo "* $STEPEMOJII $STEPNAME: $STEPSTATUS" >> "$FILE"
fi
AZURE_BUILD_URL="${SYSTEM_COLLECTIONURI}/${SYSTEM_TEAMPROJECT}/_build/results?buildId=${BUILD_BUILDID}"
echo "$EMOJII Status for '$BUILD_DEFINITIONNAME': $STATUS. [View results]($AZURE_BUILD_URL)" > commit-comment.md
./jenkins/add-commit-comment.sh "--token=$(github-pat)" "--hash=$(Build.SourceVersion)" "--file=commit-comment.md"
rm -f commit-comment.md
./jenkins/add-commit-status.sh "--token=$(github-pat)" "--hash=$(Build.SourceVersion)" "--state=$GH_STATE" --target-url="$AZURE_BUILD_URL" --description="$STATUS" --context="$BUILD_DEFINITIONNAME"
echo "$EMOJII Status for '$BUILD_DEFINITIONNAME': $GH_STATE. [View results]($AZURE_BUILD_URL)\n" | cat - "$FILE" > "$FILE.tmp"
mv "$FILE.tmp" "$FILE"
./jenkins/add-commit-comment.sh "--token=$(github-pat)" "--hash=$(Build.SourceVersion)" "--file=$FILE"
./jenkins/add-commit-status.sh "--token=$(github-pat)" "--hash=$(Build.SourceVersion)" "--state=$GH_STATE" --target-url="$AZURE_BUILD_URL" --description="$GH_STATE" --context="$BUILD_DEFINITIONNAME"
rm -f "$FILE"
displayName: Add GitHub comment / status
condition: always()

0 comments on commit 835b28d

Please sign in to comment.