diff --git a/BuildServices.asciidoc b/BuildServices.asciidoc index 3d2b087..33b352d 100644 --- a/BuildServices.asciidoc +++ b/BuildServices.asciidoc @@ -173,55 +173,61 @@ Same for your code documentation. Detailed guide, which the following example originates from: + http://blaxpirit.com/blog/22/advanced-uses-of-travis-ci-with-nim.html[Advanced uses of Travis CI with Nim] +https://github.com/oprypin/nim-random/blob/ed21c4a1289d9314901f253e6edce826a794b17e/.travis.yml[Real example] + + [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 +compiler: gcc matrix: + include: + - {} + - compiler: clang + - env: nim_channel=devel allow_failures: - # Ignore failures when building against the devel Nim branch - - env: BRANCH=devel + - env: nim_channel=devel fast_finish: true +before_install: + - nim_channel="${nim_channel-stable}" + - | + if [ "$nim_channel" = stable ]; then + nim_branch="v$(curl https://nim-lang.org/channels/stable)" + else + nim_branch="$nim_channel" + fi 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 --depth 1 git://github.com/nim-lang/csources csources/ - cd csources + if [ ! -x "nim-$nim_channel/bin/nim" ]; then + git clone -b "$nim_branch" https://github.com/nim-lang/nim "nim-$nim_channel/" + pushd "nim-$nim_channel" + git clone --depth 1 https://github.com/nim-lang/csources csources/ + pushd csources sh build.sh - cd .. + popd 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 + pushd "nim-$nim_channel" + git fetch origin "$nim_branch" + if ! git merge FETCH_HEAD | grep "Already up.to.date"; then bin/nim c koch ./koch boot -d:release fi fi - cd .. + popd before_script: - - export PATH="nim-$BRANCH/bin${PATH:+:$PATH}" + - export PATH="nim-$nim_channel/bin${PATH:+:$PATH}" script: # Replace uppercase strings! - - nim c --cc:$CC --verbosity:0 -r MYFILE.nim + - nim compile --cc:$CC --verbosity:0 --run MYFILE.nim # Optional: build docs. - nim doc --docSeeSrcUrl:https://github.com/AUTHOR/MYPROJECT/blob/master --project MYFILE.nim cache: directories: - nim-master - - nim-devel + - nim-stable branches: except: - gh-pages