Using Nim with CircleCI

Feb 08, 2015

Using Nim with CircleCI is fairly easy, the same instructions can be used for bootstrapping as usual.

What is CircleCI?

CircleCI is a new continuous integration service that is particularly suitable for open source projects. They allow 1 free VM for all projects, and 4 free VMs if you attach it to a Github repo. It seems to use the same model as Github and Bitbucket: Free for individuals and OSS, paid for corporations.

Setting up the environment

dependencies:
  pre:
    - |
        if [ ! -x ~/bin/nim ]; then
          if [ ! -x ~/nim/bin/nim ]; then
            git clone -b devel --depth 1 https://github.com/Araq/Nimrod.git ~/nim/
            git clone -b devel --depth 1 git://github.com/nimrod-code/csources ~/nim/csources/
            cd ~/nim/csources
            sh build.sh
            cd ../
            bin/nim c koch
            ./koch boot
          fi

          ln -s ~/nim/bin/nim ~/bin/nim
        fi

  cache_directories:
    - "~/bin/"
    - "~/nim/"

Lets go over that again.

Running tests

test:
  override:
    - nim c -r tests/all

This is straightforward, just add the appropriate command to the circle.yaml file. The command you’ll have use depends on how you’ve set up your tests.

Other notes

You can use Nim from master or a tag, just adapt the git commands appropriately.

You may also want to check out https://howistart.org/posts/nim/1. It provides a guide to getting started with Nim and suggests a similar setup for CI!