-
based on and trying to reproduce: https://stackoverflow.com/questions/21053657/how-to-run-travis-ci-locally/49019950#49019950
-
get the right build image from your travis build online (check build logs for "INSTANCE")
-
search for a matching docker image on docker hub
-
TODO: make a docker file out of this
cd <to you project directory>
docker run -dt --rm --name travisbuild -v $PWD:/project travisci/ubuntu-ruby:16.04 /sbin/init
docker exec -it travisbuild /bin/bash
- install
travis
as usertravis
apt-get install sudo
useradd -m -u 1000 travis
echo "travis ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
su - travis
git clone https://github.com/travis-ci/travis-build
(
cd travis-build
mkdir -p ~/.travis
ln -s $PWD ~/.travis/travis-build
sudo gem install bundler
bundle install
bundler add travis
bundler binstubs travis
)
# fix for travis compile
for repo in travis-support travis-rollout travis-github_apps; do
git clone https://github.com/travis-ci/$repo.git
(cd $repo
gem build $repo.gemspec
sudo gem install $repo
)
rm -rf $repo
done
exit
# remove sudo permission
sed -i -e '/^travis/d' /etc/sudoers
- now run
lint
orcompile
as often as you want
docker exec -it -u travis -w /project travisbuild travis lint
docker exec -it -u travis -w /project travisbuild travis compile
- may be needed when using a different base image. on
ubuntu-ruby
it was not needed.
apt-get install -y -q ruby ruby-dev build-essential
gem install travis --no-rdoc --no-ri
- take image: caktux/travis-cli
- running the script seems to require "apt-get"!
cd <your git project>
docker run --rm -it -v $PWD:/project --entrypoint /bin/sh caktux/travis-cli
(cd /
git clone https://github.com/travis-ci/travis-build
cd travis-build
mkdir -p ~/.travis
ln -s $PWD ~/.travis/travis-build
gem install bundler
gem install travis
# required dependencies
apk add -U gcc libc-dev make bash
bundle install --gemfile ~/.travis/travis-build/Gemfile
#bundler binstubs travis
)
travis compile > travis-test.sh
chmod +x travis-test.sh