DEV Community

Cover image for Super fast Electron builds with CircleCI πŸš€
kontrollanten
kontrollanten

Posted on • Updated on

Super fast Electron builds with CircleCI πŸš€

Recently I switched from Travis to CircleCI, since I had some problems with getting my Travis stages working accurate. The results was overwhelming.

Simple Docker configuration

Since CircleCI jobs can run in Docker containers, it's get really simple to configure electron-builder multi build:

# Travis
script:
  - |
    if [ "$TRAVIS_OS_NAME" == "linux" ]; then
      docker run --rm \
        --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \
        -v ${PWD}:/project \
        -v ~/.cache/electron:/root/.cache/electron \
        -v ~/.cache/electron-builder:/root/.cache/electron-builder \
        electronuserland/builder:wine \
        /bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn release --linux --win"
     fi

# CircleCI
deploy-linux:
  docker:
    - image: electronuserland/builder:wine
  steps:
    - run: yarn --link-duplicates --pure-lockfile
    - run: yarn release --linux --win

The Circle config is much easier to read and maintain, since everything is based on Docker you don't need to pass environment variables you want to use in the container.

Almighty debug support

With Docker you can always run the jobs with the same environment locally, which makes everything easier to debug. If that's not enough, you can always SSH into the build container.

Super fast

For 4 minutes after a push commit I've the response from

  • Linting
  • React unit testing
  • Electron unit testing
  • Spectron e2e testing

Ten minutes later I'll also have Linux and MacOS builds deployed and ready to download. No more queues (at least yet) and no more waiting. Since a CI environment is supposed to support me as a developer I think it's vital that the feedback is quick and that I never have to wait for over 5-10 minutes until I have the response. A big plus is that I don't have to see the pride flag in my builds any more. πŸ₯³

To see my whole Circle config, you can check here.

Top comments (0)