Shashikant86.XcodeServer

CI Status

Xcode Server: Easy Setup for iOS Continuous Integration

=========

This tool helps you set up an iOS Continuous Integration Service on macOS using Apple's Xcode Server. It also creates a local development environment for iOS Developers, providing all necessary tools such as Xcode, Swift, Fastlane, Carthage, Cocoapods, and many Homebrew packages. You can fully customize your environment using variables. Note that you need a pre-downloaded XIP file for Xcode installation.

Requirements

  • macOS High Sierra
  • Xcode 9 or later

Xcode versions earlier than 9 are not compatible with this tool.

Xcode Installation Guidelines

You can install Xcode using a couple of methods; choose the one that works best for you:

  • Xcode XIP in files directory of your playbook

Put the appropriate xip file in the files/ directory of your playbook or in your home directory ~/Xcode_9.1.xip. Then, set the xcode_src variable to the version of Xcode you want to install.

xcode_src: Xcode_9.1.xip

What’s Included:

This tool installs the following components to set up your iOS Continuous Integration Server:

  • Xcode 9+ Installation
  • Xcode Server Service
  • macOS defaults: Controls system settings and software updates
  • Homebrew: A package manager for macOS (optional)
  • RVM and custom Ruby versions with pre-installed Gems like bundler, Fastlane, Cocoapods, Xcpretty (optional)

You can modify your own playbook to change default settings and create a custom setup.

Role Variables:

This tool offers numerous variables to help you configure your own playbook. Check defaults/main.yml for all variables. You can override the defaults/main.yml variables for your setup. The main variables to change are:

xcode_src: Xcode_{your_version}.xip

xcode_server_user: {your_xcodeserver_user}
ansible_ssh_user: {your_ansible_ssh_user}

How to Use This Tool:

If you have a new Mac with fresh macOS installed, you can set up your Xcode Server for Continuous Integration by creating a playbook for this role and configuring variables as you need.

Assuming you have Ansible installed, download the tool using this command:

$ ansible-galaxy install Shashikant86.XcodeServer

Next, create your own playbook by setting the necessary variables. You can refer to the defaults/main.yml file here. An example playbook looks like this:

Example Playbook

Create a new directory called XcodeServer and another inside it named files. Place the Xcode XIP in the files directory.

$ mkdir XcodeServer
$ mkdir XcodeServer/files
$ touch XcodeServer/xcs_playbook.yml

Create xcs_playbook.yml inside the XcodeServer directory with the following content:

---
- hosts: localhost
  connection: local

  vars:
    clean_xcode: yes
    clean_rvm: yes
    clean_homebrew: yes

    configure_xcode: yes
    configure_xcodeserver: yes
    configure_macos_defaults: yes
    configure_ruby_rvm: yes
    configure_homebrew: yes

    xcode_src: Xcode_9.1.xip

    xcode_server_user: your_username
    ansible_ssh_user: your_username

    ruby_version: 2.4.0
    rubygems_packages_to_install:
      - bundler
      - xcpretty

    macos_sleep_options:
      - systemsetup -setsleep Never
      - systemsetup -setharddisksleep Never
      - systemsetup -setcomputersleep Never

    macos_animation_options:
      - defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
      - defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
      - defaults write com.apple.dock expose-animation-duration -int 0
      - defaults write com.apple.dock launchanim -bool false

    macos_software_autoupdates:
      - softwareupdate --schedule off

    homebrew_use_brewfile: true
    homebrew_brewfile_dir: '~'
    homebrew_repo: https://github.com/Homebrew/brew
    homebrew_prefix: /usr/local
    homebrew_install_path: "{{ homebrew_prefix }}/Homebrew"
    homebrew_brew_bin_path: /usr/local/bin
    homebrew_upgrade_all_packages: no

    homebrew_installed_packages:
      - autoconf
      - bash-completion
      - git
      - carthage
      - gpg
      - boost
      - cmake
      - ssh-copy-id
      - openssl
      - wget
      - curl

    homebrew_taps:
      - homebrew/core
      - caskroom/cask
      - homebrew/binary
      - homebrew/dupes
      - homebrew/versions

    homebrew_cask_apps:
      - postman

  roles:
    - Shashikant86.XcodeServer

Replace ansible_ssh_user and xcode_server_user with your username and set other variables as needed. Now run your playbook:

$ ansible-playbook xcs_playbook.yml

Watch as your Mac Mini servers are set up for iOS Continuous Integration.

Setting Up Continuous Integration with Travis

You can test this role on TravisCI by skipping the Xcode configuration, as TravisCI has its own Xcode images. Test everything else on TravisCI. You can view the TravisCI setup in the .travis.yml file and playbook/config in the tests directory. Check the TravisCI output here.

Dependencies

None

License

MIT

Author Information

Shashikant Jagtap

Informazioni sul progetto

Xcode Server Setup macOS for Continuous Integration using Apple Xcode Server

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