Shashikant86.iOS-Dev

Ansible Setup for iOS Development and Continuous Integration

This document describes a setup process using Ansible to create a Continuous Integration (CI) environment for iOS development on macOS. It also provides tools for iOS developers to create and configure their development environment.

Overview

This Ansible role helps configure a CI service for iOS developers. It includes tools such as Xcode, Swift, Fastlane, Carthage, CocoaPods, and many other useful packages via Homebrew. You can customize your setup using various configuration options.

Supported Versions

  • macOS Sierra
  • Xcode 8.0.2
  • Xcode 8.3 beta (XIP format)

Note: This setup works with Xcode version 8 and later.

Requirements

  1. Install Ansible: It is a Python library, so you can install it using pip:
    $ easy_install pip
    $ pip install ansible
    

Xcode Installation Options

You have a couple of options to install Xcode:

  1. Using XIP/DMG File:

    • Place your dmg or xip file in the files/ directory of your playbook.
    • Set the following variables in your playbook:
    configure_xcode_playbook_files: yes
    xcode_major_version: 8.2
    xcode_src: Xcode_8.2.xip
    
  2. Downloading via Mac App Store (Requires Apple Developer ID and Password):

    • Add your credentials to the variables like this:
    use_mac_store: yes
    mas_email: "[email protected]"
    mas_password: "your_password"
    mas_installed_apps:
      - { id: 497799835, name: "Xcode (8.1)" }
    

It's best to use the first method (XIP/DMG file) to ensure stability and to avoid issues with authentication.

What This Role Includes

This role sets up several important software packages for your iOS CI server:

  • Xcode Installation
  • Swiftenv (Swift version manager)
  • Dependency management tools (Carthage, CocoaPods, Swift Package Manager)
  • Continuous Delivery tools (Fastlane)
  • macOS configurations
  • Homebrew (macOS package manager)
  • Selected Homebrew packages (git, carthage, swiftlint, etc.)
  • Ruby Version Manager (RVM) and customized Ruby versions
  • Essential Ruby Gems (bundler, Fastlane, CocoaPods, xcpretty)
  • Command Line Tools for Xcode
  • Xcode Simulator (default version 9.2)

Customizing Your Playbook

You can customize your setup further by using various variables listed in defaults/main.yml. Key variables include:

Xcode Variables

  • Skip Xcode Configuration: Set configure_xcode_documents_dir to no.
  • Configuration for XIP/DMG: Use configure_xcode_playbook_files to manage Xcode installation using provided files.

Swift and Ruby Version Management

  • Custom Swift: Enable different Swift versions with configure_custom_swift.
  • Ruby Versioning: Manage Ruby versions via RVM by enabling configure_ruby_rvm.

Homebrew Configuration

  • Customize the installation path and packages using homebrew_install_path, homebrew_installed_packages, etc.

Example Playbook

Here’s a simple example of a playbook (playbook.yml):

---
- hosts: localhost
  connection: local
  remote_user: root

  vars:
    configure_xcode: no
    configure_custom_swift: yes
    ruby_version: 2.4.0
    homebrew_installed_packages:
      - git
      - curl
      - carthage

  roles:
    - Shashikant86.iOS-Dev

Setting Up CI with TravisCI

To test this role with TravisCI, disable the Xcode configuration since TravisCI provides its own images for Xcode. You can see examples of the .travis.yml configuration file in the tests directory.

License

This project is licensed under the MIT License.


Author: Shashikant Jagtap

Informazioni sul progetto

Fully automated and customised macOS setup for iOS development & CI

Installa
ansible-galaxy install Shashikant86.iOS-Dev
Licenza
Unknown
Download
315
Proprietario
Mobile DevOps, CI/CD, Mobile Build & Test Automation. Swift, Kotlin, XCTest, XCUITest, Xcode Server, Apple Developer tools, Flutter, Ruby, PHP etc