From 6c300a6ef840ca4bd8dd83acf6e2ff15d11dae10 Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Sat, 20 Oct 2018 13:40:32 +0200 Subject: [PATCH] Add Docker and choosenim option to Travis --- BuildServices.asciidoc | 80 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/BuildServices.asciidoc b/BuildServices.asciidoc index 0d1a9f1..b08a260 100644 --- a/BuildServices.asciidoc +++ b/BuildServices.asciidoc @@ -80,14 +80,90 @@ workflows: ## Building Nim projects on Travis CI +### Using Docker +[source,yaml] +---- +sudo: required +services: + - docker +before_install: + - docker pull nimlang/nim +script: + - docker run nimlang/nim nim --version + - docker run -v "$(pwd):/project" -w /project nimlang/nim sh -c "nimble install -dy && nimble test" +---- + +### Using choosenim + +[source,yaml] +---- +language: c + +cache: ccache +cache: + directories: + - .cache + +matrix: + include: + # Build and test against the master (stable) and devel branches of Nim + - os: linux + env: CHANNEL=stable + compiler: gcc + + - os: linux + env: CHANNEL=devel + compiler: gcc + + # On OSX we only test against clang (gcc is mapped to clang by default) + - os: osx + env: CHANNEL=stable + compiler: clang + + allow_failures: + # Ignore failures when building against the devel Nim branch + # Also ignore OSX, due to very long build time + - env: CHANNEL=devel + - os: osx + fast_finish: true + +## BEGIN: Assuming you rely on external dependencies +addons: # This will only be executed on Linux + apt: + packages: + - libyourdependency + +before_install: + # On MacOS flame/blis can be tested as it is an homebrew package + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libyourdependency; fi +## END: Assuming you rely on external dependencies + +install: + - export CHOOSENIM_NO_ANALYTICS=1 + - curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh + - sh init.sh -y + - export PATH=~/.nimble/bin:$PATH + - echo "export PATH=~/.nimble/bin:$PATH" >> ~/.profile + - choosenim $CHANNEL + +script: + - nimble refresh + - nimble test + +branches: + except: + - gh-pages +---- + +### Devel branches + Building your code on Travis CI is useful to check regressions against the master and devel branches of Nim. 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] -If you don't want to rebuild the Nim compiler you can instead install the .deb packages listed on the CircleCI guide above using https://docs.travis-ci.com/user/installing-dependencies[this config] - [source,yaml] ---- # Copied from https://github.com/nim-lang/Nim/wiki/TravisCI