[dev] How we got Travis Continuous Integration for multiple language projects in a mono repo

With every commit that makes it to the monorepo both the Android and Desktop project are built and tested. This post documents how we did that.

This post is intended to help developers on other projects where they need wish to start multiple travis jobs for completely different configurations.

Most documented examples on the web on how to use travis are usually focused only on building a single project in a single environment. But what if your repository has multiple projects that need to run under different contexts and programming languages.

At FrostWire we have a big monorepo which is host to multiple projects:

android/ # android client (java8, android-sdk environment gradle build)
desktop/ # desktop client and tests (java11+ gradle build)
common/ # common java sources for android and desktop projects


Travis allows you to define what we understand to be a “Job Matrix”, where each entry in this Matrix specifies an individual job (and they can run in parallel when you push your commit and travis gets word of it)

Here’s our first version of .travis.yml to build the android and desktop projects, and run tests jobs on a single git push:
matrix:
  include:
    # android build job
    - language: android
      dist: xenial
      android:
        components:
          - build-tools 29.0.2
          - android-29
          - extra-google-google_play_services
          - extra-google-m2repository
          - extra-android-m2repository
      licenses:
        - 'android-sdk-preview-license-52d11cd2'
        - 'android-sdk-license-.+'
        - 'google-gdk-license-.+'
      script:
        - yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;29.0.2"
        - cd android
        - pwd
        - ./gradlew assembleDebug
    # desktop build job
    - language: java
      jdk:
        - openjdk11
      script:
        - cd desktop
        - gradle build
    # desktop/common tests job
    - language: java
      jdk:
        - openjdk11
      script:
        - cd desktop
        - gradle test

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s