[Piglit] [PATCH v3] travis: add docker based cmake build job

Andres Gomez agomez at igalia.com
Wed Jan 31 21:24:03 UTC 2018

On Mon, 2018-01-29 at 14:06 -0800, Eric Anholt wrote:
> Andres Gomez <agomez at igalia.com> writes:
> > Until now we were only running the python unit tests.
> > 
> > It seems desirable to also check that the CMake based build compiles
> > successfully. We do that now using docker.
> > 
> > The docker build can be tweaked with some environment variables and,
> > also, be stored in the docker hub if desired. Check the changes for
> > extra details regarding these variables.
> > 
> > v2: Removed other build possibilities other than just from inside
> >     Travis-CI, as suggested by Juan.
> > v3: Replaced the "RELEASE" parameter to create the docker image with
> >     "PARENT" and removed some unneeded documentation after v2, as
> >     suggested by Juan.
> > 
> > Cc: Dylan Baker <dylan at pnwbakers.com>
> > Cc: Juan A. Suarez <jasuarez at igalia.com>
> > Signed-off-by: Andres Gomez <agomez at igalia.com>
> > Reviewed-by: Juan A. Suarez <jasuarez at igalia.com>
> I'm definitely interested in extending our tests using Travis, but could
> you add some comments explaining what this system does?  Do we do a
> bunch of image build work (numpy/six/mako install) on each Travis build,
> or does it get cached?  Do I need to do any setup in Travis in order for
> this to take effect?

Yes, I should have been already more verbose with explanations when
posting this patch in the first place.

First, thanks to your reply I've sent a new v4 version after finding a
couple of issues.

With this v4 version, you can check this travis build, which is where
I've tested the patch:

There you will see that, in addition to the usual 5 python builds
running the unit tests, there is an additional cmake build, this is the
docker based build:

Without any special setup in Travis, the docker build will run with the
default options. This will be done on every run:
 * Download the parent ubuntu:xenial image.
 * Install building dependencies from APT.
 * Install additional Python dependencies (numpy/six/mako).
 * Build piglit.

The build is, however, quite quick since docker and travis have many of
the needed bits cached and it also makes use of ccache, but still this
process has to happen every time.

Now, this patch allows a couple of additional tweaks:
   1. You can select a different parent image by setting in Travis-CI the
      env variable DOCKER_PARENT. You could want to do this for different
      reasons. From the top of my head:
       * To speed up the build; using a parent image with the APT and
      Python dependencies already installed.
       * To create a build in which there are additional or alternative
      libraries installed; for example, at Igalia, we have the docker
      image "igalia/mesa:released-17.3.3.debug". This way, in case we
      want to later use the generated docker image to test piglit, we
      will be able to run the test suite against mesa-17.3.3 built with
      debug symbols.
   2. You can define a docker hub repository to which upload the generated
      build as "$DOCKER_IMAGE:$DOCKER_TAG". For that, you have to set in
      Travis-CI the following env variables:
       * DOCKER_IMAGE: The path to the docker hub repository you want to
      use. We use "igalia/mesa".
       * DOCKER_TAG: The specific tag for the newly created image. For
      example, you could use "piglit". Therefore, in our case, a new
      build will be uploaded as "igalia/mesa:piglit".
       * DOCKER_USERNAME: Your user to the docker hub.
       * DOCKER_PASSWORD: Your password for the docker hub.

Combining 1. and 2. you could have, for example, automatic builds of
piglit's master uploaded to your personal docker hub with a specific
mesa version installed. This is very useful for later running the test
suite. It is also a good way of providing a specific environment for
debugging/reproducing a bug and share with other developers.

I hope this clarifies further the aim of this integration.

PS: If this is accepted in piglit, my next step is to work in a patch
proposal for having a similar use case for mesa. This will ease the
combination of 1. and 2. that I was mentioning.


More information about the Piglit mailing list