iOS CI&CD tips pt 1

Sergey Petrachkov
2 min readJan 30, 2022

--

If you are an indie developer or work in a small team you don’t probably need super sophisticated solutions for continuous integration and continuous delivery. In this series of articles, I’m gonna share a few tips on how to set up CI&CD for a small-to-medium scale iOS project.

Today we’re gonna start with the basic things like building your project and running tests. During my career, I used different tools from Jenkins to super-custom solutions written in Swift. But nowadays I am back to Fastlane. So, that’s what we’re gonna use in this series.

Fastlane is very well-documented. I will share some basic things that I use for each and every project that I’m working on.

What’s going on here? I like to have a separate directory where all the building and testing is happening. You can see it in the first lines of the snippet.

To test things I usually have Unit tests and UI tests. Sometimes you need to test some flows that need some permissions to be set. We have simctl for that. But not all permissions can be set using simctl even though the docs state that.

That’s why I use AppleSimUtils tool that handles things correctly. You can also see that I defined APPLESIMUTILS=”#{File.expand_path(“..”, Dir.pwd)}/Scripts/applesimutils” below:

So, here’s what we do: run unit tests on a built-in simulator, and for integration tests, we prepare a separate simulator and give it special permissions. After the tests run you’ll find .xcresult file under /build/ directory with all the necessary data about tests run and tests coverage (if enabled in your scheme).

In the next article, I’ll tell you how to integrate what we have with Github Actions and how to distribute the app. Have a good day!

--

--

Sergey Petrachkov

Amsterdam-based iOS developer born and bred in Siberia. Follow my "Metal in the Attic" Youtube channel :)