## Building Nim projects on Travis CI Building your code on Travis CI is useful to check regressions against the master and devel branches of Nim. Same for your code documentation. [source,yaml] ---- # Copied from https://github.com/nim-lang/Nim/wiki/TravisCI language: c env: # Build and test against the master and devel branches of Nim - BRANCH=master - BRANCH=devel compiler: # Build and test using both gcc and clang - gcc - clang matrix: allow_failures: # Ignore failures when building against the devel Nim branch - env: BRANCH=devel fast_finish: true install: - | if [ ! -x nim-$BRANCH/bin/nim ]; then git clone -b $BRANCH --depth 1 git://github.com/nim-lang/nim nim-$BRANCH/ cd nim-$BRANCH git clone -b $BRANCH --depth 1 git://github.com/nim-lang/csources csources/ cd csources sh build.sh cd .. rm -rf csources bin/nim c koch ./koch boot -d:release else cd nim-$BRANCH git fetch origin if ! git merge FETCH_HEAD | grep "Already up-to-date"; then bin/nim c koch ./koch boot -d:release fi fi cd .. before_script: - export PATH="nim-$BRANCH/bin${PATH:+:$PATH}" script: # Replace uppercase strings! - nim c --cc:$CC --verbosity:0 -r MYFILE.nim # Optional: build docs. - nim doc --docSeeSrcUrl:https://github.com/AUTHOR/MYPROJECT/blob/master --project MYFILE.nim cache: directories: - nim-master - nim-devel branches: except: - gh-pages ---- ### Smaller cache with infrequent updates For speed, it is better to use a smaller cache, and to update only when you *want* to test with the latest Nim compiler. For a quick set-up, fork this https://github.com/cdunn2001/nim-project-template[nim-project-template], attach a TravisCI Webhook, and `git push`. To update the nim compiler, just clear the cache via the *settings* drop-down at the upper-right in TravisCI, and rebuild. ### Other ideas * http://forum.nim-lang.org/t/1903[Easy travis integration with latest nim devel]