-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathmain.yml
84 lines (76 loc) · 2.94 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# If xcversion install hangs, you might need an active UI session. Open VNC and log into the
# machine. Keep the VNC window open as long as the installation is running.
#
# We install the full Xcode on all machine types so that we can use test machines for notarization.
#
# List of available versions: $ xcversion list
# See https://xcodereleases.com for an Xcode support matrix.
---
- name: Ensure Ruby is installed for xcode-install
become: yes
become_user: "{{ ansible_user }}"
homebrew:
name: ruby@2.7 # no 3.0 yet for fastlane (https://github.com/fastlane/fastlane/issues/17931)
state: present
- name: Configure Bash profile extension for Ruby
become: yes
copy:
content: |
if [ -d "/usr/local/opt/ruby@2.7/bin" ]; then
export PATH=/usr/local/opt/ruby@2.7/bin:$PATH
export PATH=`gem environment gemdir`/bin:$PATH
fi
dest: /etc/profile.d/ruby
owner: root
group: wheel
- name: Reset SSH connection to ensure that shell/profile changes take effect
shell: sleep 1; pkill -u {{ ansible_ssh_user }} sshd
async: 3
poll: 2
- name: Ensure xcode-install and its dependencies are installed
become: yes # for system-wide installation
gem:
name: "{{ item }}"
state: latest
user_install: no
environment:
PATH: /usr/local/opt/ruby@2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
loop:
- fastlane # explicitly list fastlane to get latest version
- xcode-install
- name: Set xcversion location for x86_64
set_fact:
xcversion: /usr/local/lib/ruby/gems/2.7.0/bin/xcversion
when:
- ansible_architecture == "x86_64"
- name: Set xcversion location for arm64
set_fact:
xcversion: xcversion
when:
- ansible_architecture == "arm64"
# On ARM, we can use 12.x because compiling on ARM requires at least Xcode 12.
- name: Install Xcode on Apple Silicon Macs
shell: "{{ xcversion }} install 12.4 --retry-download-count=10"
when: ansible_architecture == "arm64"
environment:
XCODE_INSTALL_USER: "{{ Apple_ID_User }}"
XCODE_INSTALL_PASSWORD: "{{ Apple_ID_Password }}"
FASTLANE_SESSION: "{{ FASTLANE_SESSION }}"
FASTLANE_DONT_STORE_PASSWORD: 1
# 10.x is our default version on Intel. It requires 10.14.3+. As a consequence, some test machines
# with older macOS won't have Xcode installed.
- name: Install Xcode on Intel Macs
shell: "{{ xcversion }} install 10.3 --retry-download-count=10"
when: ansible_architecture == "x86_64" and ansible_distribution_version is version('10.14.3', operator='>=')
environment:
XCODE_INSTALL_USER: "{{ Apple_ID_User }}"
XCODE_INSTALL_PASSWORD: "{{ Apple_ID_Password }}"
FASTLANE_SESSION: "{{ FASTLANE_SESSION }}"
FASTLANE_DONT_STORE_PASSWORD: 1
- name: Cleanup Xcode installation files
shell: "{{ xcversion }} cleanup"
environment:
XCODE_INSTALL_USER: "{{ Apple_ID_User }}"
XCODE_INSTALL_PASSWORD: "{{ Apple_ID_Password }}"
FASTLANE_SESSION: "{{ FASTLANE_SESSION }}"
FASTLANE_DONT_STORE_PASSWORD: 1