How to build for several platforms on a CI server?

I’m at the very start of developing a cross-platform game with the intent to target Windows, Linux, MacOS, Android and iOS. I’m looking for both a framework and a CI system which supports these platforms.
MonoGame looks like a great fit, but I haven’t really found an up-to-date guide which covers building for all of the aforementioned platforms.

It seems pretty obvious that I’m going to need an OSX build slave for MacOS and iOS, so I would prefer Travis CI at this point.

What about the other platforms, especially Android (since it seems to have the most dependencies)?
Should I try to build all five configurations on MAC or maybe split that into Windows and MAC build slaves?
Does anyone maybe have a .travis.yml that builds for Windows, Linux and Android?

I build Windows, WindowsGL, and WindowsUniversal on Windows and the rest on Mac.

I’ve had great luck with Azure DevOps so far. They recently added free Windows and Mac CI/CD pipelines for open source projects, which I’ve used to build the MonoGame framework packages for all platforms. I haven’t tried building a complete app yet because I wasn’t planning to make it open source, but I think it may be possible to do even for iOS.

I can give you more details on that if you’re interested.

1 Like

Thanks, haven’t stumbled across Azure DevOps during my research. It looks like a valid alternative to Travis indeed.
I forgot to mention I’m Open Source but looks like you assumed so :wink:

After an initial getting-used-to-MAC-command-line-tools phase, I managed to build an APK on a MAC OS Client with the following yaml file:

# Trigger the Azure DevOps build upon changes in the master or AzureTest branches
trigger:
- master
- AzureTest

# Build on MacOS 
pool:
  vmImage: 'macOS-10.13'

# Configure paths here
variables:
  buildConfiguration: 'Release'
  outputDirectory: '$(build.binariesDirectory)/$(buildConfiguration)'

steps:
# Install NuGet
- task: NuGetToolInstaller@0

# Restore any missing dependencies
- task: NuGetCommand@2
  inputs:
    restoreSolution: '**/*.sln'
    
# Install MonoGame and other dependencies
- task: ShellScript@2
  inputs:
    scriptPath: azure/install.sh
    
# Build any .csproj containing "Android" as a Xamarin project
- task: XamarinAndroid@1
  inputs:
    projectFile: '**/*Android*.csproj'
    outputDirectory: '$(outputDirectory)'
    configuration: '$(buildConfiguration)'

With install.sh being:

#!/bin/bash
# Download Monogame 3.7.1 (-L is important so curl follows redirects)
curl -L -O https://github.com/MonoGame/MonoGame/releases/download/v3.7.1/MonoGame.pkg
# Install the MonoGame package
sudo installer -pkg "$(pwd)/MonoGame.pkg" -target /

I can now dive into signing the apk using an encrypted keystore and deploying it somewhere. Once that’s done, I will look into the other platforms.
I will publish a guide on how to set up a cross-platform CI project once I’m done testing everything.