Skip to content

Instantly share code, notes, and snippets.

@voidrender
Created June 3, 2015 16:34
Show Gist options
  • Save voidrender/d75d94dcb1a980117f18 to your computer and use it in GitHub Desktop.
Save voidrender/d75d94dcb1a980117f18 to your computer and use it in GitHub Desktop.
A sample script to add to an After Integration Run Script step for an Xcode Server bot.
#!/bin/sh
report_path=$XCS_BOT_NAME/$XCS_INTEGRATION_NUMBER
# This is the path to a directory we have hosted by the web server on our Xcode Server
host_path=/Library/Server/Web/Data/Sites/Alcove
output_directory=$host_path/$report_path
# Replace both instances of YourProduct with the name of your product
# You probably don't need all of the --remove-filter options, either.
alcove --verbose --product-name YourProduct --remove-filter *Masonry*,*YourProduct.iOSTest*,*iPhoneSimulator* --output-directory $output_directory
# Calculate coverage number and delta for this build
# Note: this currently only looks back one build number, so if the previous build failed
# this number will be equal to the total coverage.
alcove_percent_file=alcove-percent.txt
coverage_this_build=$(<$output_directory/$alcove_percent_file)
last_integration_number=$[$XCS_INTEGRATION_NUMBER-1]
coverage_last_build=$(<$host_path/$XCS_BOT_NAME/$last_integration_number/$alcove_percent_file)
coverage_diff=$(echo "$coverage_this_build $coverage_last_build" | awk '{printf "%+.1f", $1 - $2}')
# Post build results to slack, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment