Trigger iOS Unit Test Check-In Github with Jenkins (Automation)
Learn to deploy unit-test check-in with Jenkins
Wonder how to make automation for triggering the build and unit test in git with Jenkins? So this one could be the easiest tutorial you can follow. First let open our Jenkins web page, login, and create a new Free project. Once you create it, go to configure tab and you will go to this page below
Fill up the textbox above on the description and tick the GitHub project row and fill in the project URL. Scroll down until you see the Restrict where this project can be run, and tick it if you have a specific node being set up on your machine. If not, you can ignore this option.
Now go over to Source Code Management tab. Fill the blank column for Repositories row with your data (Fill it depend on your configuration). After that in Branches to build row, fill in ${ghprbActualCommit}
. What does it mean? Those are the environment variables for GitHub pull request builder. Check this Github PR Builder link for more information.
Go to Build triggers tab. Fill and tick the GitHub PR Builder and add the correct credentials and admin list on the Jenkins. For the Skip build phrase and Crontab line is optional, you can fill it the same or leave it with the default one.
Now go to this section and don’t forget to tick the Build every PR Automatically without asking (Dangerous!). This one is so important, tick it to make it trigger the automation. Also, you can put either blacklist or whitelist target branches for triggering the unit test check.
Go to the fun part! Let build the unit test checker. Fill in the commit status context in the Trigger Setup row and the build result for SUCCESS and the message itself. (You can set the FAILURE message as well).
Go down to this Build Environment section and also tick this row and put the same thing with above. If you put differently then you will trigger 2 different checkers. Actually you can ignore the first one if you use the GHPRB Trigger in the beginning.
For the last tab go to Advanced Xcode build options and put the Custom xcodebuild arguments. Fill the scheme the same as your product scheme. You can add more custom arguments base on your necessary requirements.
Move over to your GitHub repo, once you trigger a new commit, it will try to trigger Jenkins to build and run the xcodebuild and give us the feedback whether its success or not.
Finally, you are able to make your first setup in Jenkins!. Let me know what do you think