I'm working on an operating systems, and I want to use Travis CI for continuous integration. Basically, my OS can perform a bunch of kernel tests on boot, and I want them to be run at every push.
However, setup environment is a bit complex, and so I'm using a Docker Image that I want my application to be run on the Docker Image, exactly like Tavis CI's example is doing: https://docs.travis-ci.com/user/docker/
As you can see in the Dockefile of the example: https://github.com/travis-ci/docker-sinatra/blob/master/Dockerfile , repo is clonned inside the Image, and soin Travis CI's configuration file (https://github.com/travis-ci/docker-sinatra/blob/master/.travis.yml), they just have to run "make".
This is easy because this project is a single branch project, but me I want the tests to be operated to the lastest comitted branch (The one which triggered Travis's build).
Which solution do you think I can use for this? Using environment variables on Travis CI that I the pass to Docker image and then checkout the branch passed as parameter? There is not more "classy options"?
I think both my Docker file and .travis.yml files are not necessary as there are WIP. Thank you.
To get the branch that was last committed to you can use a shell script like this:
git branch --sort=-committerdate | awk -F " " /*/'{print $2}'
The awk
command is just cleaning up the output from the branch
command so only the branch name is returned.
You can use the result of the above with git checkout
to switch to the last updated branch before your make
command.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments