Preconditions:
- POSIX or Windows system
- Install Docker
- A GitHub repo that already builds on Travis
Postcondition:
- Identical output as if run from Travis
Project status:
- Alpha quality, please post notes here and fork baby fork, I will try to test and accept changes here
Notes:
- Inspiration and original discussion: https://stackoverflow.com/a/24936720/300224
- This code stolen shamelessly from https://medium.com/google-developers/how-to-run-travisci-locally-on-docker-822fc6b2db2e because Medium isn't Gist
-
Install Travis on Docker
# choose the image according to the language chosen in .travis.yml $ docker run -it -u travis quay.io/travisci/travis-jvm /bin/bash # now that you are in the docker image, switch to the travis user sudo — travis # Install a recent ruby (default is 1.9.3) rvm install 2.3.0 rvm use 2.3.0 # Install travis-build to generate a .sh out of .travis.yml cd builds \ git clone https://github.com/travis-ci/travis-build.git \ cd travis-build \ gem install travis \ travis # to create ~/.travis \ ln -s `pwd` ~/.travis/travis-build \ bundle install # Create ssh key for Github ssh-keygen -t rsa -b 4096 -C “YOUR EMAIL REGISTERED IN GITHUB” # Click enter to use default location for key # You can choose empty passphrase by clicking enter twice # Now that we have the key, let’s share with Github less ~/.ssh/id_rsa.pub # Copy the contents of the id_rsa.pub
-
Go to your Github SSH key settings
-
Create a new ssh key with title: “docker key”: “PASTE THE KEY CONTENTS HERE”
-
Go back to docker terminal
# Create project dir, assuming your project is `AUTHOR/PROJECT` on GitHub cd ~/builds \ mkdir AUTHOR \ cd AUTHOR \ git clone [email protected]:AUTHOR/PROJECT.git \ cd PROJECT # change to the branch or commit you want to investigate # compile travis script into bash script travis compile > ci.sh # Go to bash script and fix the branch name vi ci.sh # in Vi type “/branch” to search and add the right branch name # — branch\=\’\NEW_BRANCH’\ # You most likely will need to edit ci.sh as it ignores ‘matrix’ and ‘env’ keywords bash ci.sh
Before anyone else wastes their time, I'm only receiving this as output, even if travis-build lint says it's clean and I've followed all the information in all the comments on all the github issues in the world to get it working >:-(