Build and Test Swift Packages in Azure Pipelines

Image for post
Image for post

With the introduction of Swift Package Manager (SPM), a number of projects are migrating fully but the majority are keeping SPM alongside Carthage and/or CocoaPods.

Migrating a package from CocoaPods to SPM may be backed with a couple of reasons such as better versioning, better support inside Xcode, etc. Internally, we started migrating some of our reusable code from CocoaPods to SPM. At this time, we can only migrate if some criteria are met:

  1. Pre-complied binaries are not required. This happens to be most of our packages since they are only in git repositories accessible internally. SPM does not yet support pre-compiled binaries a.k.a binary frameworks. See forum for more.
  2. There are no static resources that need redistribution e.g. json files, images, etc. Once again, SPM does not yet support resources. See bug report for more.

In the upcoming Swift 5.3 release, these should be fixed.

With that out of the way, we sort to setup automated builds for each code check-in in Azure DevOps which is what we use for all of our development work. The pipeline is simple with only 4 steps, and the first one being optional depending on how you handle versioning. I thought I should share this with whomever might be looking for it.

Here is the pipeline definition file. You can add it to the root of your repository in a file named .

Learning to live the best life I can

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store