Skip to content

Instantly share code, notes, and snippets.

@ondreian
Last active March 7, 2016 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ondreian/91211dd575f3f73c1c5d to your computer and use it in GitHub Desktop.
Save ondreian/91211dd575f3f73c1c5d to your computer and use it in GitHub Desktop.
Travis-CI file for Nim: includes Nimble and caches nim compilation, and enables PCRE support
language: c
dist: trusty
# Run builds with 2 different values of the `nim_branch` environment variable
env:
- nim_branch=master
- nim_branch=devel
# Run builds with 2 different choices of a C compiler
compiler:
- gcc
- clang
# This meams we get a 2x2 build matrix, with a total of 4 builds
matrix:
# It's OK if our project fails to build with Nim devel, but we still want to check it
allow_failures:
- env: nim_branch=devel
before_install:
- |
sudo apt-get update -y
sudo apt-get install libpcre3 libpcre3-dev -y
install:
- |
if [ ! -x nim-$nim_branch/bin/nim ]; then
# If the Nim executable does not exist (means we haven't installed Nim yet)
# (do what we did before)
git clone -b $nim_branch --depth 1 git://github.com/nim-lang/nim nim-$nim_branch/
cd nim-$nim_branch
git clone -b $nim_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
# We already have the repository, go to it
cd nim-$nim_branch
# Download latest commits from the repository
git fetch origin
if ! git merge FETCH_HEAD | grep "Already up-to-date"; then
# Recompile Nim (using itself), only if there were new changes
bin/nim c koch
./koch boot -d:release
fi
fi
cd ..
# export nim
export PATH="nim-$nim_branch/bin:$PATH"
git clone --depth 1 https://github.com/nim-lang/nimble.git nimble/
mkdir lib
nim c -r nimble/src/nimble install <<< y
script: nim c --run ./tests/test.nim
cache:
directories:
- nim-master
- nim-devel
- nimble
branches:
except:
- gh-pages
@ondreian
Copy link
Author

ondreian commented Mar 7, 2016

The mkdir lib command is for nimble packages that have binDir option set to lib since nimble doesn't check for folder existence before compilation. I raised this issue here nimble: #215.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment