ios-sdk-examples
                                
                                
                                
                                    ios-sdk-examples copied to clipboard
                            
                            
                            
                        Mapbox iOS Examples + Xcode Server Bots
Goal — one button Xcode builds with Xcode Server Bots 🤖 or XCS.
The repo for ios-sdk-examples already has a CI solution.  The goal with this issue is to document how to use Mapbox iOS Examples with Xcode Server Bots, to better understand the build, and to use the excellent reporting tools built into Xcode.
Advantages of XCS
- The reporting from Xcode gives insight into the automated Tests & Code Coverage
 - Allows testing on many simulators and devices in my local setup
 - No extra dependency to install
 - the Mapbox team has done an excellent job over the years of adding features and tests. These notes may help others that are learning the code or want to use Mapbox APIs in their own repos. We use it in our lab, and we thought it were worthwhile to share out.
 
Related to https://github.com/mapbox/mapbox-gl-native-ios/issues/493
How to
Notes excerpted from roblabs / xcode-continuous-integration which discusses a process to setup XCS for any Xcode project.
- The Git branch and Xcode scheme you want to test is very important, so check out a local copy to your development folder. For example, set the branch you want and perform the initial step to make the Xcode Project.
 
From a fresh clone of the Mapbox project ios-sdk-examples
git clone \
  https://github.com/mapbox/ios-sdk-examples.git \
  tmp/ios-sdk-examples
cd tmp/ios-sdk-examples
# Initial steps to properly getting a local build working
pod --version
pod install --repo-update
xed Examples.xcworkspace
- 
The call to
xedwill launch the Xcode application and opens the given documents. Fromman xed. - 
Change the Scheme to
Examples.
 - 
On your development Mac, choose
Product>Create Bot. - 
Add Pre-Integration Triggers
- Script 
environment- Git repo metadata & Build versions - Script 
mapbox- project specific build commands 
 - Script 
 
Pre-integration Script `environment` 👉
#!/bin/sh
# Pre-Integration Script
#   environment
# MARK: - Xcode Server Environment Variable Reference
# https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/EnvironmentVariableReference.html
echo XCS=${XCS}
echo "XCS_BOT_NAME             = ${XCS_BOT_NAME}"
echo "XCS_INTEGRATION_NUMBER   = ${XCS_INTEGRATION_NUMBER}"
echo "XCS_PRIMARY_REPO_DIR     = ${XCS_PRIMARY_REPO_DIR}"
echo "XCS_SOURCE_DIR           = ${XCS_SOURCE_DIR}"
echo "XCS_DERIVED_DATA_DIR     = ${XCS_DERIVED_DATA_DIR}"
echo "XCS_PRIMARY_REPO_REVISION=${XCS_PRIMARY_REPO_REVISION}"  # Only used when not checking out a branch or a tag.
echo "XCS_PRIMARY_REPO_BRANCH  = ${XCS_PRIMARY_REPO_BRANCH}"   # Only used when checking out a branch.
echo "XCS_PRIMARY_REPO_TAG     = ${XCS_PRIMARY_REPO_TAG}"      # Only used when checking out a tag.
echo "XCS_OUTPUT_DIR           = ${XCS_OUTPUT_DIR}"
echo "XCS_BOT_ID               = ${XCS_BOT_ID}"
echo "XCS_BOT_TINY_ID          = ${XCS_BOT_TINY_ID}"
echo "http://Bots JSON         = https://$(hostname):20343/api/bots"
echo "http://bots/latest       = https://$(hostname)/xcode/bots/latest"
echo "http://latest this bot   = https://$(hostname)/xcode/bots/latest/${XCS_BOT_TINY_ID}"
echo "http://Integration JSON  = https://$(hostname)/xcode/internal/api/integrations/${XCS_INTEGRATION_ID}"
echo "http://Download          = https://$(hostname)/xcode/internal/api/integrations/${XCS_INTEGRATION_ID}/assets"
echo "xcbot://See Bot in Xcode = xcbot://$(hostname)/botID/${XCS_BOT_ID}/integrationID/${XCS_INTEGRATION_ID}"
# MARK: - build environment
hostname
sw_vers
# Xcode version & path
/usr/bin/xcodebuild -version
/usr/bin/xcode-select -print-path
Pre-integration Script `mapbox` 👉
#!/bin/sh
# Pre-Integration Script
# Script:  ios_sdk_examples_pod_install
# MARK: - Update PATH
echo $PATH
export PATH=/usr/local/bin:.:$PATH
echo $PATH
# set verbose
set -v
cd ${XCS_PRIMARY_REPO_DIR}
pwd
# MARK: - project specific build commands
# WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
export LANG=en_US.UTF-8
# Versions of build dependencies
pod --version
# This version is heavy with pod
pod install --repo-update
wait
echo xed ${XCS_PRIMARY_REPO_DIR}/Examples.xcworkspace
wait
References:
- https://github.com/roblabs/xcode-continuous-integration
 - https://help.apple.com/xcode/mac/11.4/index.html?localePath=en.lproj#/dev466720061