How can I replicate the Travis CI build environment on my local machine?

I’m trying to contribute to several open source projects, but I’m unable to get them working on my local machine. Fortunately, these open source projects use Travis CI. Unfortunately, I don’t know how to replicate the Travis CI environment on my local machine, even with the use of Docker images I’ve created myself, which don’t really replicate the setup.

You should get them working on your local machine. Travis, like any CI, is only good for autotesting – checking, asynchronously, that your project works in all officially supported environments. It’s not good for actual development – the turnaround time is too long for that.

A project has to have some hints in it as to what environment it’s supposed to run in (the kind of build system/build scripts, typical commands and data in them, the flavor of paths used etc). In more established projects, there’s a README or specialized build instructions with that kind of information.

I have been unable to get these projects to work on my local machine. What I’m seeking is a Docker environment that replicates the Travis build environment so that I know exactly what it takes to get things working. Without the Travis build environment on my local machine, getting the configuration details requires editing the .travis.yml file, pushing the change, and waiting for Travis CI to run it.

If I had the Travis build environment set up on my local machine, I could poke around without having to make Git pushes and wait for Travis CI to run everything.

Ask each project how they do local development. Sometimes you’ll find instructions in CONTRIBUTING.md file (sometimes in a .github/ directory).

There is no officially supported way AFAIK, especially since Travis dropped Docker-based environments. They do not provide the VMs they use AFAICS. There are a number of unofficial instructions on the Net but all that I have seen deal with the aforementioned Docker-based environments.

What I know is that software provided in repos at https://github.com/travis-ci is a part of their infrastructure. https://github.com/travis-ci/travis-ci#other-repositories provides a rough overview of what role each plays. The fact that these modules are specifically built for their infrastructure rather than your use case is likely the reason why they don’t support local runs.

They do support on-site installations for enterprise customers. Though they probably make a small copy of their infrastructure in these cases, too, rather than anything you are asking for.

I hoped that @BanzaiMan would come here to say something official since you were not satisfied with my initial reply. But since he didn’t, I hope the above is informative.

Now, you can replicate a build machine by examining it from a build script, uploading custom stuff somewhere (I did that to diagnose problems with their stock scripts) and arranging non-custom stuff the same way.

Then you should be able to somehow use https://github.com/travis-ci/travis-build to generate a job script from .travis.yml and run it in that replicated environment…

But if getting a project to build on a local machine is too hard for you, this will likely be too hard, too.