Testing / CI For Packages On Linux


In a similar vein to Testing / CI On Windows With AppVeyor and Testing with Travis, I’d like to document a way to achieve a CI build on Linux, now that Atom distributions are available for RHEL and Ubuntu.

Has anyone achieved a Linux CI build already that I can use as a template? The goal is to resolve this issue: https://github.com/atom/ci/issues/2


Download locations for Linux:


@joefitzgerald We have linux CI internally at GH, see script/cibuild and cibuild-linux https://github.com/atom/atom/tree/master/script

Not sure of the status of public CI for linux though.


Yes, I noticed that. I’m interested in anyone who has a CI build for a package, as it’s a bit different than CI for Atom itself. Notably:

  • You have to bootstrap an Atom installation
  • You have to run tests using a virtual display (xvfb?)


I’ve been working on getting a repeatable CI build for packages on Linux and have run into an issue I can’t figure out.

I started out on Wercker, then figured out how to reproduce the behavior in a Docker container: https://github.com/joefitzgerald/go-plus/blob/ee315c15630ea237323a320b9a32ec03f4f70892/Dockerfile

To reproduce:

  • apm develop go-plus
  • cd ~/github/go-plus
  • git checkout wercker-linux-builds-2
  • git pull
  • docker build .
  • docker run -i -t <container from last step e.g. 566e7b9d5550> /bin/bash
  • cd ~
  • start-stop-daemon --start --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb – :99 -screen 0 1024x768x24 -ac +extension GLX +extension RANDR +render -noreset
  • sleep 5
  • apm test

You’ll notice a bunch of tests fail; pretty much everything that actually requires the package to be active.

When I run all the commands required to build this container interactively in a trusty container I can make all tests pass.

My issue is I have no idea what’s failing. How can I make apm print out console errors that are leading to the package(s) not activating? /cc @kevinsawicki @nathansobo @benogle @ProbablyCorey @leedohm @abe @thedaniel


… And an example of the same behavior on Wercker (also Ubuntu 14.04): https://app.wercker.com/#buildstep/546539011ed704ad2c1e8ebd

TypeError: Cannot read property 'mainModule' of undefined
        at [object Object].<anonymous> (/root/spec/gobuild-spec.coffee:48:61)
        at _fulfilled (/usr/share/atom/resources/app/node_modules/q/q.js:787:54)
        at self.promiseDispatch.done (/usr/share/atom/resources/app/node_modules/q/q.js:816:30)
        at Promise.promise.promiseDispatch (/usr/share/atom/resources/app/node_modules/q/q.js:749:13)
        at /usr/share/atom/resources/app/node_modules/q/q.js:557:44
        at flush (/usr/share/atom/resources/app/node_modules/q/q.js:108:17)
        at process._tickCallback (node.js:378:11)


@kevinsawicki @nathansobo @benogle @ProbablyCorey @leedohm @abe @thedaniel any thoughts? Why aren’t package activation errors showing up in apm test logs?


Sorry to not replying sooner, I’ll try building this tomorrow, I doesn’t have ubuntu available right now and I’m not familiar with docker so I’ll have to update myself on that too ^^.


Hmm, really not sure, all console.log/console.warn messages should print to standard out and you are getting output from the test proceess.

[7687:1113/231053:INFO:CONSOLE(92)] "Download the React DevTools for a better development experience: http://fb.me/react-devtools", source: /usr/share/atom/resources/app/node_modules/react-atom-fork/lib/React.js (92)

I would wonder if the specs also fail if run in a 14.04 VM, have you tried that?


@kevinsawicki that’s not been my experience, even when running the specs interactively in Atom on OS X. That is:

  • When something is preventing go-plus from activating, the error is logged to the console but does not appear in the test logs (visible in the spec runner)
  • The logs in the spec runner reflect what I’m seeing in the apm output to stdout
  • Because we’re not actually running an interactive session, I have no way to do what I would normally do (CMD-Option-I) and open the inspector to look at the console output

That said, like I mentioned above, I can get all the tests to pass successfully if I use the same base Docker image and interactively type all the commands that are executed non-interactively when I build the Docker image. So it’s definitely possible - I just am a little stuck without the console errors that I know are happening but that I cannot see.


@kevinsawicki Evidence of this console (missing) error behavior: on Windows, I’m not getting console errors in apm test output that my users are reporting (and seem to be failing the build): https://ci.appveyor.com/project/joefitzgerald/go-plus/build/178 + https://github.com/joefitzgerald/go-plus/issues/96


@kevinsawicki Clearly, it’s working on OS X, but potentially not on Windows and Linux: https://travis-ci.org/joefitzgerald/go-plus. When I ran the tests (apm test) interactively on Windows, the console errors display correctly. Seems to be something to do with interactive vs noninteractive.


@joefitzgerald I recently made it working in my package. Thanks for sharing your Dockerfile. See the werker result: https://app.wercker.com/#build/54b53524da3a4af764179315 and my Dockerfile: https://github.com/kn1kn1/language-context-free/blob/master/Dockerfile. I hope this helps you.


Looks like this is the key difference in your Dockerfile:

RUN start-stop-daemon --start --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +extension RANDR +render -noreset && \
    sleep 3 && \
    export DISPLAY=:99 && \
    apm test

Particularly: && export DISPLAY=:99 &&. Makes complete sense. Thanks for posting this update!