Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Jenkis CI: Release and Testing Automation for iOS

Jenkis CI: Release and Testing Automation for iOS

I gave this talk at TACOW Toronto on March 7, 2017. It focuses on how we have our Jenkins continuous integration setup at Hipo and how it supports our development and testing processes.

Sample build scripts are shared at https://github.com/Hipo/jenkins-ios-automation

Taylan Pince

March 07, 2017
Tweet

More Decks by Taylan Pince

Other Decks in Programming

Transcript

  1. 1. Clean /usr/bin/xcodebuild \ -workspace "$XCODE_WORKSPACE_PATH" \ -scheme "$XCODE_SCHEME" \

    -configuration "$XCODE_CONFIG" \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ clean || die "Clean failed"
  2. 3. Build & Run Unit Tests /usr/bin/xcodebuild \ -workspace "$XCODE_WORKSPACE_PATH"

    \ -scheme "$XCODE_SCHEME" \ -configuration "$XCODE_CONFIG" \ -sdk iphoneos \ OBJROOT="$PWD/build" \ SYMROOT="$PWD/build" \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO
  3. 4. Update Provisioning ./deploy/resign_with_device.rb \ tryouts-app-id="$TRYOUTS_APP_ID" \ tryouts-token="$TRYOUTS_APP_TOKEN" \ itunes-token="$ITUNES_TOKEN"

    \ team-id="$TEAM_ID" \ app-name="$APP_NAME" \ bundle-identifier="$APP_BUNDLE_IDENTIFIER" \ provision-output-path="$PROVISION_PATH"
  4. 5. Load Keychain KEYCHAIN_PATH="/usr/local/keychains/$KEYCHAIN_NAME.keychain" /usr/bin/security list-keychains \ -s "$KEYCHAIN_PATH" /usr/bin/security

    default-keychain \ -s "$KEYCHAIN_PATH" /usr/bin/security unlock-keychain \ -p "$KEYCHAIN_PASSWORD"\ "$KEYCHAIN_PATH"
  5. 6. Archive /usr/bin/xcodebuild \ -workspace "$XCODE_WORKSPACE_PATH" \ -scheme "$XCODE_SCHEME" \

    -configuration "$XCODE_CONFIG" \ -sdk iphoneos \ ONLY_ACTIVE_ARCH=NO \ CODE_SIGN_IDENTITY="$DEVELOPER_NAME" \ PROVISIONING_PROFILE="$PROVISIONING_UUID" \ archive -archivePath "$APP_ARCHIVE_PATH"
  6. 8. Generate Release Notes PREVIOUS_TAG=`git describe HEAD^1 --abbrev=0 --tags` GIT_HISTORY=`git

    log --no-merges --format="- %s" $PREVIOUS_TAG..HEAD` RELEASE_DATE=`date '+%Y-%m-%d %H:%M:%S'` RELEASE_NOTES="Build: $CURRENT_TAG Uploaded: $RELEASE_DATE $GIT_HISTORY"
  7. 9. Distribute curl https://tryouts.io/applications/$TRYOUTS_APP_ID/upload/ \ -F status="2" \ -F notify="0"

    \ -F notes="$RELEASE_NOTES" \ -F build="@$IPA_PATH" \ -H "Authorization: $TRYOUTS_APP_TOKEN"
  8. 1. Prepare Simulator Build /usr/bin/xcodebuild \ -workspace "$XCODE_WORKSPACE_PATH" \ -scheme

    "$XCODE_SCHEME" \ -configuration "$XCODE_CONFIG" \ -sdk iphonesimulator \ OBJROOT="$PWD/build" \ SYMROOT="$PWD/build" \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO
  9. 2. Upload to Saucelabs zip -r "$SIM_ZIP_PATH" "$SIM_APP_PATH" curl -u

    $SAUCELABS_USERNAME:$SAUCELABS_TOKEN \ -X POST "http://saucelabs.com/rest/v1/storage\ /$SAUCELABS_USERNAME/$APP_NAME.zip?overwrite=true" \ -H "Content-Type: application/octet-stream" \ --data-binary "@$SIM_ZIP_PATH"
  10. login_with_username openapp wait until page contains element ${Power_Button} tap ${Power_Button}

    verify login options page is opened with email signin with email sleep 3s #verify signin page is opened enter email ${user1_email} enter password ${user1_password} ok, sign in wait until page contains element ${Main_AddFigure_Button} page should contain text Following [Teardown] close application