Skip to content

Commit

Permalink
azdevops: xamarin#75.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Apr 5, 2019
1 parent ee02d94 commit f1fbd7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 5 additions & 6 deletions tools/devops/build-samples-report-to-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
env | sort

TOKEN=$1
shift
shift 1
STEPS="$*"

EMOJII=""
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 '[:lower:]' '[:upper:]' | sed -e 's/|//' -e 's/-//')
Expand All @@ -21,12 +20,12 @@ for STEP in $STEPS; do
EMOJII=""
GH_STATE=failure
fi
echo "* $STEPEMOJII $STEPNAME: $STEPSTATUS" >> "$FILE"
echo "* $STEPEMOJII $STEP: $STEPSTATUS" >> "$FILE"
done

printf "%s" "$EMOJII Status for '$BUILD_DEFINITIONNAME': $GH_STATE. [View results]($AZURE_BUILD_URL)\n\n" | cat - "$FILE" > "$FILE.tmp"
printf "%s" "$EMOJII Status for '$BUILD_DEFINITIONNAME': $GH_STATE. [View results]($AZURE_BUILD_URL)\\n\\n" | cat - "$FILE" > "$FILE.tmp"
mv "$FILE.tmp" "$FILE"

./jenkins/add-commit-comment.sh "--token=$TOKEN" "--hash=$BUILD_SOURCEVERSION" "--file=$FILE"
./jenkins/add-commit-status.sh "--token=$TOKEN" "--hash=$BUILD_SOURCEVERSION" "--state=$GH_STATE" --target-url="$AZURE_BUILD_URL" --description="$GH_STATE" --context="$BUILD_DEFINITIONNAME"
rm -f "$FILE"
./jenkins/add-commit-status.sh "--token=$TOKEN" "--hash=$BUILD_SOURCEVERSION" "--state=$GH_STATE" --target-url="$AZURE_BUILD_URL" --description="$BUILD_DEFINITIONNAME" --context="$BUILD_DEFINITIONNAME"
rm -f "$FILE"
14 changes: 12 additions & 2 deletions tools/devops/build-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ variables:
name_filter_af: '^[A-Fa-f].*$'
name_filter_gr: '^[G-Rg-r].*$'
name_filter_rest: '^[^A-Ra-r].*$'
azure_build_url: '$(System.CollectionUri}/$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)'

jobs:
- job: ReportStartToGitHub
pool:
vmImage: 'macOS-10.13'
steps:
- bash: |
./jenkins/add-commit-status.sh "--token=$(github-pat)" "--hash=$BUILD_SOURCEVERSION" "--state=pending" --target-url="$AZURE_BUILD_URL" --description="$BUILD_DEFINITIONNAME" --context="$BUILD_DEFINITIONNAME"
displayName: Set pending GitHub status
- job: macOS
dependsOn: ReportStartToGitHub
displayName: Build samples
timeoutInMinutes: 360
strategy:
Expand Down Expand Up @@ -134,7 +144,7 @@ jobs:
displayName: Environment
condition: always()

- job: AddGitHubComment
- job: ReportResultsToGitHub
dependsOn: macOS
condition: always()
pool:
Expand All @@ -159,5 +169,5 @@ jobs:
"Release|iPhoneSimulator" \
"Debug|Mac" \
"Release|Mac"
displayName: Add GitHub comment / status
displayName: Report results to GitHub as comment / status
condition: always()

0 comments on commit f1fbd7c

Please sign in to comment.