TravisCI Push Dev to Master on Success

In the Software Engineering course I’m taking we were given a .travis.yml and makefile to help us automate our project deployment. By default even thought the makefile would notice missing files, the TravisCi testing would pass. So I ended up modifying the makefile to have it fail and force the TravisCI announce the broken build. I also added a new step which on a successful deployment would automatically merge the Dev and Master branches. 

Makefile

check:
   @for i in $(FILES);                                        \
   do                                                         \
     if [ -e $$i ]; then echo "$$i found" ; else touch .failed && echo "$$i NOT  FOUND" ; fi \
   done ;                                                      \
   if [ -e .failed ]; then exit 1; else echo "Found all"; fi

push:
ifeq ($(TRAVIS_BRANCH),dev)
    git config --global user.email "mb@gmail.com"
    git config --global user.name "Marek5050"
    git remote set-branches --add origin master
    git fetch
    git reset --hard
    git checkout master --force 
    git merge --no-ff --no-edit dev
    git push origin master
endif

.travis.yml


script:
    - make collatz-tests
    - make Collatz.html
    - make Collatz.log
    - make test
    - make check
    - make push

Links

Original post on Github

.travis.yml

makefile

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s