Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I have Travis-CI build my electron app for multiple OSes in parallel?

Background

I work on an open-source Github Electron app for transcribing video. I want my app to be multiplatform, so I use open-source travis-ci.org to build it for both MacOS and Linux (Ubuntu), then publish the binaries to Github releases.

What I'd like to have happen

Travis builds for OSX and Linux concurrently.

What actually happens

With my current YAML configuration, Travis tests and builds serially: it makes the linux version first, then the mac version only after the Linux build finishes. (I believe it builds in that order because it's the order in which I've specified OSes in my YAML). Here's an example of that serial build behavior

Below is my .travis.yml, excluding my Github access token:

language: node_js
node_js:
  - '8'
matrix:
  include:
  - os: linux
    dist: xenial
    sudo: required
  - os: osx
cache:
  yarn: true
notifications:
  email: false
script:
  - yarn dist
deploy:
  provider: releases
  api_key: $ENCRYPTED_GITHUB_TOKEN
  skip_cleanup: true
  on:
    tags: true

How I've tried to solve this on my own

I've read and re-read Travis-CI's documentation on build matrices and build matrix expansion. I've also read documentation on Travis's beta build stages feature. But, I don't think I fully understand how to define a build matrix, then have all the expanded configurations go through a stage. In this case, define two OSes, but only have to write one stage with the same command: yarn dist to make the distributable. (By default, that command will build a binary for the host OS.)

My hunch about how to answer my question

My guesses are that one (or more) of these are true:

  1. What I want isn't possible
  2. What I want is possible; I just have to make a minor tweak.
  3. What I want is possible, but my attempt to do it is largely wrong and/or misunderstands the relationship between matrices, jobs, and stages.
  4. I'm encountering something Electron-specific (although the build for Linux seems to go fine)

My apologies

I wish I understood Travis better, and I thank you for your patience and your help.

like image 645
briandk Avatar asked Oct 17 '22 06:10

briandk


1 Answers

Your setup is correct for what you want to achieve. If the two builders do not run in parallel there's one of two things happening:

  • You set the project's concurrency to 1 in options (or this is the default nowadays) blog post
  • There simply aren't enough free resources on travis side at that the time to run both. This could especially be relevant for macOS builds, where IIRC they have a lot fewer builders than for linux.
like image 125
renefritze Avatar answered Oct 31 '22 15:10

renefritze