Set up GitLab CI with an iOS project that uses Cocoapods

We all write tests for our applications and keep them in version controlled systems like GitLab or GitHub. However, how can we configure GitLab to run Unit and UI tests for us?

I couldn’t find a lot of documentation explaining how to set up continuous integration for iOS on GitLab, therefore I am writing this article.

Victor Peschenkov explains in his article how to use GitLab CI with Fastlane. My article focuses on how to run everything yourself.

Requirements

In order to set up GitLab Runner for iOS we need the following tools:

Please install these tools now before continuing.

Configure Xcode

Make sure to download Xcode form the Mac App Store. Once it is installed open it and create a project to make sure it is completely installed and running.

iOS Project

I created a sample project to get you started more quickly.  Feel free to fork it or use your own project. Please verify your installation using:

  • git checkout git@gitlab.com:skofgar/ios-ci-sample.git
  • switch into the project folder and run pod install
  • run the following command on your machine to verify that you can build and run the tests successfully – which means no „failures“ or other error messages
xcodebuild test \
-workspace "CI Sample.xcworkspace" \
-scheme "CI Sample" -destination 'platform=iOS Simulator,name=iPhone XR,OS=12.0' \
| xcpretty -s

Installing GitLab Runner

iOS projects require a special GitLab Runner. Usually gitlab-runner can be hosted on any machine (virtual machine, Linux-, Mac- or Windows-system). However, iOS related projects need a GitLab Runner, that is hosted on a Mac with Xcode in order to build successfully.

Install GitLab Runner on a Mac

Follow these steps to configure GitLab Runner on your Mac:

  • use the command brew install gitlab-runner
  • go to your GitLab instance to Settings > CI/CD
  • disable shared runners (alternatively you can use tags to only use your Mac for building the iOS project)
  • go toSpecific Runners and save your GitLab server url and token
GitLab CI/CD Settings page showing URL and token for specific runner
(token has been removed on purpose)
  • register a your runner as described in GitLabs documentation
  • gitlab-runner register

          1. when prompted, enter the url form above
          2. next up, enter the registration token
          3. name your runner
          4. leave the tags blank
          5. use the shell executor

  • start your runner using:
cd ~
gitlab-runner install
gitlab-runner start

Please note, should you restart your computer you’ll likely have to start the GitLab Runner again.

Reload the CI/CD settings page. If everything worked out, you should be able to see your runner in the Specific Runners section:

Listing of successfully activated specific GitLab runners

Create gitlab-ci.yaml

Once we have a GitLab runner for iOS and a project, we need to configure it. Please add a gitlab-ci.yaml and insert:

stages:
  - build

variables:
  LC_ALL: "en_US.UTF-8" # apparently xcpretty won't function correctly otherwise

before_script:
  - gem install cocoapods
  - pod install

build_project:
  stage: build
  script:
    - xcodebuild clean -workspace "CI Sample.xcworkspace" -scheme "CI Sample" | xcpretty
    - xcodebuild test -workspace "CI Sample.xcworkspace" -scheme "CI Sample" -destination 'platform=iOS Simulator,name=iPhone XR,OS=12.0' | xcpretty -s

As soon as you commit this file, GitLab-CI should kick in and start building your project and then run the tests.

That’s it you’ve done it!

Feedback

What do you think? Please let me know if you run into any problems or have improvement suggestions.

Resources

  • https://about.gitlab.com/2016/03/10/setting-up-gitlab-ci-for-ios-projects/
  • https://medium.com/flawless-app-stories/how-to-set-up-gitlab-continuous-integration-for-ios-projects-without-a-hustle-53c2b642c90f
  • https://github.com/supermarin/xcpretty/issues/73

Deploy static websites using GitLab CI

One of my favorite tools of 2017 is GitLab. I guess my enthusiasm about it even helped convince my company to switch over to GitLab. In this post I am describing how to automize the deployment of mlp.skofgar.ch using a GitLab CI Pipeline Job.

GitLab offers an one-stop solution for almost anything™ that we might need as a software developer. There’s a ton of bells and whistles from issue tracking to continuous integration (CI), continuous deployment (CD), monitoring. GitLab could easily replace Jenkins, Jira, GitHub, wiki systems, bug trackers and deployment monitoring services. It even integrates with Kubernetes.

Enough with praises – I recently cleaned up my neural network project that I worked with Camila on and wanted to facilitate the deployment process. However, since I don’t run a large container management system and don’t control all the details of the server I was going to put it on (my website is hosted by Cyon), I needed a different way.

Read More

More panoramas

Oregon

 

Around Mt. Shasta

Panorama Tutorial

Columbia Basin – 360° Farm

I was visiting family in Washington and created the following 360° panoramas with my Drone.

The first shot was taken with an altitude of 500 meters above ground. It gives a brief overview of the area:

The second shot is just on top of a workshop:

 

Apple Music improvements for iOS 11

Apple Music is a cool streaming service, which I have been enjoying for a while now. Even though the service is well done, the integration into the Music App on the iPhone could be improved. With WWDC 2017 and iOS 11 coming up, lets look at what could change.

Some of my major issues and ideas on how they could be improved are:

  • In case of a poor network connection I would like to play songs that are on my phone. Therefore: Show which songs are on the phone vs in the cloud. I don’t really need to know if I „own“ the song vs or if it’s a cached „streamed“ song.
  • The custom stations are great, but sometimes I would like to add the one song. Therefore: Allow songs to be added to Up Next while listening to a station.  Stopping the station, playing the song and then restarting the station provides a bad user experience and is also confusing. Since I can skip songs in the station it would be great to also allow insertion of songs.
  • Nowadays a good search is the goto than browsing through thousands of songs. Therefore: Instead of having the search in a separate tab, just put it everywhere as a global search. Such as putting it next to the title or as pull-down.
  • Some songs are not available for streaming but can be purchased. Therefore: When searching, also include songs that are only available for purchase. It would be very useful to know about available purchasable songs and would prevent users of having to switch to the iTunes Store and search again manually.
  • Make Up Next (or another feature) more prominent.

Design proposal for improvements of Apple Music in iOS 11

Design proposal for improvements of Apple Music in iOS 11

What do you think about my ideas and suggestions? What would you like to see improved in the next version of Apple Music?

DailyUI #003 – Landing Page

Well, I definitely slacked a little bit with the UI-challenge, but I finally got back to it!

Challenge #3 asked to create a landing page. I chose to try to work on Delta’s homepage (no pun intended). I did not change their interface terribly, but here are two things I would like to highlight:

  1. Instead of many links I propose the usage of a more universal search-field. Enter a flight-code, a question or even a ticket number and it should try to find relevant information for you. Sure, you can use Google for that, but why shouldn’t a big company’s website be able to offer a smart site-wide search?
  2. It’s an airline, so why not show a plane ✈️ on the landing page 😉
  3. Only ask for information you cannot derive – I know this idea has some drawbacks, but what if a user is only asked the destination they would like to fly to? Maybe a previous page visit gave us the departure airport or it can be derived from the users current location. – Of course we should allow the customer to change this information in the process.

Please let me know what you think and where I can make improvements!

Image for UI/UX challenge showing a redesign of Delta's website

 

ID3 Decision trees ?

As part of the Machine Learning class in (CIS 678) at GVSU, Camila and I created a decision tree tool that analyzes and processes a data-set, where each entry has a different combination of attributes and an expected outcome. The system then finds the «best» attributes, that allow deciding which outcome will occur with the least amount of questions, for previously seen or  new data.

The website & tool takes data-sets in the form of a simple text-file, then parses & processes it and finally creates a decision tree ? based on that data. Please check it out and let us know what you think and how you like it.

The tool can be accessed on this sub-site.

 

Tree example

DailyUI #002 – Credit Card Checkout

Today’s assignment was to create a credit card checkout.

To give myself a better context, I decided to checkout a monitor and took an existing online-shop to help guide some of my decisions (you can guess which one it is 😉 ). Please let me know what you like and what you think needs improvement.

Day 002 - Credit Card Checkout

DailyUI #001 – Sign Up Screen

Hello everyone,
Today I completed my first DailyUI-Challenge #001. The task was to create a Sign Up screen.

My idea was to make it as simple as possible. Consequently I combined Sign Up and Log In. First it would start by letting the user add their email address. Then, if they already have an account it would then prompt them to enter their password. Since the user sam.fisher@mymail.com does not have an account yet, a confirmation-mail will be sent to him, to verify that the provided address actually is controlled by him.

Being able to show, whether a user needs to Sign Up or Log In, implies that the website discloses, if an email account already exists. While this brings certain drawbacks it might be okay, depending on your website.
Please let me know how you like it!

Sources:

How about fixing Blackboard?

One of the more popular online learning (and training) management systems for high schools and universities in the United States is Blackboard. However, despite the fact that it has a lot to offer, many of it’s features are hidden deep in the interface.

We all came across it [ or at least most of us 😉 ]. You come to a new school or university and for sure, every single one of them uses a different learning platform like MoodleOpenOLAT or Blackboard. These applications offer different ways for managing classes/courses, knowledge, vary greatly in features. They do have a few infamously commonalities, such as lacking simplicity, focus and consistency. However, in this particular post I would like to take a look at Grand Valley State Universities’s Blackboard (myBB) solution. As part of the CIS 623 class I am taking I received an assignment to design an improved version of it.

Why are online learning

platforms so frustrating?

In order to work on a new design I tried to locate a few of the major problem areas. There are several platform-external and -internal reasons why they might fail from my very personal opinion, such as:

Read More