Skip to content

Instantly share code, notes, and snippets.

@cyupa
Last active August 29, 2015 14:07
Show Gist options
  • Save cyupa/7b57d69e4570ee08420e to your computer and use it in GitHub Desktop.
Save cyupa/7b57d69e4570ee08420e to your computer and use it in GitHub Desktop.
Jenkins build server configuration
# Build Environment
# Importing local variables
PATH=$PATH:/usr/local/bin
source /etc/profile
# Generate the changelog file
mkdir -p ${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Changelog/ | curl -s "http://localhost:8080/job/Hyntly/$BUILD_NUMBER/api/xml?wrapper=changes&xpath=//changeSet//comment" | sed -e "s/<\/comment>//g; s/<comment>//g; s/<\/*changes\/*>//g" | sed '/^$/d;G'> ${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Changelog/changelog.txt
# Compute test results and test results metrics
/usr/local/Cellar/xctool/0.2/bin/xctool -workspace ${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Doozy.xcworkspace \
-scheme Hyntly \
-reporter plain \
-sdk iphonesimulator \
-reporter junit:test-reports/ios-report.xml \
test \
-resetSimulator \
-freshInstall
# Generate coverage report
scripts/gcovr -r . --object-directory ${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Build/Intermediates/Doozy.build/Debug-iphonesimulator/Hyntly.build/Objects-normal/i386 --xml > ${WORKSPACE}/test-reports/ios-cobertura-coverage.xml
# Compute lines of code metric for project excluding Pods
/usr/local/bin/sloccount --duplicates --wide --details ${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Doozy > ${WORKSPACE}/test-reports/ios-sloccount.sc
# Compute code duplication metric
java -Xmx512m -classpath /usr/local/Cellar/pmd/4.2.6/lib/pmd-4.2.6.jar:/usr/local/Cellar/pmd/ObjCLanguage-0.0.7-SNAPSHOT.jar net.sourceforge.pmd.cpd.CPD --minimum-tokens 100 --files ${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Doozy --language ObjectiveC --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > ${WORKSPACE}/test-reports/ios-cpd-output.xml
# Upload the build to Crahslytics
${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Pods/CrashlyticsFramework/Crashlytics.framework/submit \
69a80de6778a772693809b724041c432a5a9d01b \
1280ab46e20e91f47a0ca64015818f6a7c6747e04a3a768efb00bff8dfed6f2b \
-notesPath ${WORKSPACE}/MobileInitiative2014/iOS/Doozy/Changelog/changelog.txt \
-ipaPath ${WORKSPACE}/builds/iOS/${BUILD_NUMBER}/${BUILD_ID}/${BUILD_ID}.ipa \
-groupAliases bas,developers,testers \
# Publish duplicate code analysis results
**/test-reports/ios-cpd-output.xml
# Publish JUnit test result report
**/test-reports/ios-report.xml
# Publish SLOCCount analysis results
**/test-reports/ios-sloccount.sc
# Publish Cobertura Coverage Report
**/test-reports/ios-cobertura-coverage.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment