Add Docker and choosenim option to Travis

This commit is contained in:
Mamy Ratsimbazafy 2018-10-20 13:40:32 +02:00
parent e966e29c5f
commit 6c300a6ef8
1 changed files with 78 additions and 2 deletions

View File

@ -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