Prehistory
There is a project on
Unity3D . There are already several years (born in February 2012). After six months, I started working on it as a programmer, and after two years I was not lucky and I became responsible for building the builds. I inherited
MacMini with the
Jenkins collector installed, a minimum of documentation and the lack of an adequate build for
iOS .
I would like to finally write an adequate instruction - for the initial setting was killed a few weeks, and when you transfer to the
iMac, my old practices are already outdated. So…
Technical task
- The project is being developed on the Unity3D engine. Since development has been going on for a long time, the engine version has changed from 3.5.6 to 4.6.6 (at the time of this writing, support version 5 is not planned yet). Each version has its glitches, some versions contain vital edits for one platform and at the same time kill the assembly for another. For example, support for 64b for iOS has been added in recent versions, in early 4.x versions there was an assembly for the Google Chrome and Flash plugin, the recommended Android SDK changes from version to version. You need to have everything.
- The project is on the svn server. Specifically - subversion.assembla.com . Need support for the assembly of different branches, different subprojects, as well as projects that include parts of other projects.
- The build should be carried out for Android ( Google Play , Amazon App Store , Yandex Store ...), iOS , Windows , Mac OS , Linux (all with the possibility of publishing on Steam ). Some parts are set to run in the browser. Here we consider only the features of the assembly for each configuration.
- You need access to builds from the local network so that the tester can download, install and test.
- Standalone build, autorun after failure (power off)
Iron
Why we collect on apple products? Because you need to collect
iOS applications and send them to the
AppStore . Have a hackintosh or virtualka - have problems.
So, there is an old
MacMini in the office and the newest
iMac at home. Both cope with their work, the difference in performance and approach - there is no guarantee for the first one and it is not a pity for him (the desire to kill him on the table occurs every week), the second one is lovingly wiped with a rag and protected.
')
So, for those who want - to get acquainted with the assembly and disassembly of the first device - welcome
here . The need for assembly arose after the death of the old disk. Thanks to the instructions, the new 1 TB disk has been successfully opened and inserted.
It is worth making a digression here - I prefer to have a hard disk with several partitions, and maybe even with several operating systems. However, if the type of drive is
Fusion Drive , this will not work (my
iMac has a maximum of two disks on the disk, and the second one is inhabited by
Windows ). If the drive is normal - no problems. You can store all the important data in one section (and backup it with
Time Machine ), and store heavyweight copies of the project on another.
System installation
Deserves a separate article. Briefly:
- On the latest poppies there is an online installation. Otherwise - you need a drive or flash drive with the image of the system. Enter the Cmd + R installation menu.
- All disks and sections we call clear names. Sections with system and working data are formatted necessarily in Mac OS Extended (Journaled) . Required - not Case-sentive .
- To install the software, you need an Apple Id . It is desirable that this Apple Id match the account of the Apple developer , which is used in the preparation and pouring builds.
- In addition to the administrator account, we do not need to bind an account with normal rights. We call it jenkins , password also.
- If someone needs remote access via Chrome Remote Desktop , you’ll have to give the account administrator privileges.
- We put a normal browser and useful software at will.
- If you have problems with the display of pages - Steam Community , YouTube and others - we look once and twice .
Install Xcode
- The latest version is usually put from the store.
- When installing multiple versions - it is desirable to select a separate folder and put it there. For example - in / Applications / Xcode are Xcode_5_1_1.app and Xcode_6_1_1.app .
- Old versions can be found here .
Install Unity3D
The engine can be downloaded on
offsite (need
Mac version) version or on
your favorite tracker . On the off-line, we
register and
purchase the necessary license , depending on the needs of the project.
By default, after installing
Unity.app ,
MonoDevelop.app and the documentation are in
/ Applications / Unity . If you need to install several versions, first rename the old installation folder, for example
/ Applications / Unity_4_6_6_f2 , only after that we install the new version and rename the installation location too. All versions and patches can be found
here .
MonoDevelop is sufficient to leave the freshest, having written the path in the settings of each
Unity . In the folder
/ Users / Shared, you can find the default
Unity project - it can be demolished.
For the user
jenkins, you must
add rights to run all files. If necessary - and all the contents
.app .
Also in the settings disable the auto-discovery of the last project and register each copy.
Install Java, JDK, Android SDK
JDK and
JRE can be downloaded from
offsite .
Android SDK download
from here . After installation, we update the
SDK and set the path to it in each
Unity and check it on the test build. An example of a working configuration:
- OS X 10.10.5
- Unity 4.6.6f2
- jdk-8u60-macosx-x64
- Android SDK: Tools 24.3.4
- Android SDK: Platform-tools 23.0.1
- Android SDK: Build-tools 23.0.1
- Android SDK: SDK Platform API 23
The configuration is selected only by experience. There is no guarantee that when upgrading one of these components, the build of the build will not fall ...
SVN installation
According to
this -
subversion comes with the system. To install a specific version - I recommend using
Homebrew , we
are looking for more details
here .
Install Jenkins
- All operations are performed under the user jenkins
- Downloading from the offsite installer. We put, move to a convenient place, for example in /Users/jenkins/WORK/JENKINS_WAR/jenkins.war
- Go to the terminal, execute the command to start the collector:
java -jar /Users/jenkins/WORK/JENKINS_WAR/jenkins.war
- Check in the browser - 127.0.0.1:8080 for the presence of a collector. After closing the terminal (the collector is disabled)
- Create a folder for temporary files. For example - / Users / jenkins / WORK / JENKINS_TMP
- Create a folder for the collector. For example - / Users / jenkins / WORK / JENKINS_HOME . In it we copy the contents of the /Users/jenkins/.jenkins folder, and delete the folder itself.
- Go to the terminal and log in as administrator:
login dimamatik
- Delete the old configuration file:
sudo rm /Library/Preferences/org.jenkins-ci.plist
- Enter the following parameters (can be changed, if desired):
pp="/Library/Preferences/org.jenkins-ci.plist" sudo defaults write $pp JENKINS_HOME "/Users/jenkins/WORK/JENKINS_HOME" sudo defaults write $pp tmpdir "/Users/jenkins/WORK/JENKINS_TMP" sudo defaults write $pp war "/Users/jenkins/WORK/JENKINS_WAR/jenkins.war" sudo defaults write $pp httpPort 4242
- Checking:
defaults read $pp
- We install the rights:
sudo chown root:wheel $pp sudo chmod 644 $pp
- We unload the jenkins demon with the command:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
- Remove the demon:
sudo rm /Library/LaunchDaemons/org.jenkins-ci.plist
- We leave from the administrator:
logout
- We start the collector through the terminal once again (the page is now 127.0.0.1:4242 ). Everything should work .
More details can be found
here and
here .
Autoload, restart, death
The problem of death and resuscitation of the collector is aggravated by the use of
Mac and assembly on
Unity . We write and save scripts:
- The jenkins-runner.sh collector launch script:
- Script killing collector jenkins-killer.sh :
- Jenkins-restart.sh restart script :
To automatically start the collector, create a special application using
Automator . Select the
AppleScript Run template and create
jenkins-restart.app in the same folder as the rest of the scripts. Program code below:
on run {input, parameters} tell application "Terminal" activate if (the (count of the window) = 0) or (the busy of window 1 = true) then tell application "System Events" keystroke "n" using command down end tell end if do script "sh ~jenkins/jenkins-restart.sh" end tell return input end run
If the scripts are not in the home folder, edit the paths accordingly.
In the
jenkins user
settings we set the automatic launch of the written application. If desired, it can be used manually. We put the user on the automatic login when the system starts (if it is an office collector, and we are too lazy to come early to start it).
Learn more about the daemon - look
at the wiki or in the
general help . Generally speaking, it would be possible not to use
Automator , but to leave this mechanism by adding unloading and loading of the daemon in the scripts. However, the plug-in and reboot plugins may not work correctly.
What we have
At the moment, the system should
work . The collector (while empty) automatically starts at system startup. Any project on
Unity should normally be assembled (by hand) from under the
jenkins user. If errors occur - we look at the permissions, the installed components, we pay debts for the license. The most interesting thing to come ...
The second part can be found
here .
Update 10/6/15
- Added paragraph on the Jenkins daemon, fixed instructions for disabling it.
- Added link to offsite in the section about downloading and installing the collector.
- Comment for script and application restart.
Update 10/13/15
- Added link to the second part.
- Added die tutorial.