aboutsummaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 82537ee6986c3f65a8fec5bf65c0843538b9f870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
language: c
# 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
  # Call the commit successful as soon as the builds with master branch complete.
  fast_finish: true
install:
  - |
    STARTDIR=$(pwd)
    cd ..
    # Simply replacing "master" with `$nim_branch` everywhere means we can reuse
    # this installation script for both branches.
    if [ ! -x nim-$nim_branch/bin/nim ]; then
      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
      ./koch tools
    else
      cd nim-$nim_branch
      git fetch origin
      if ! git merge FETCH_HEAD | grep "Already up-to-date"; then
        bin/nim c koch
        ./koch boot -d:release
        ./koch tools
      fi
    fi
    cd $STARTDIR
before_script:
  # `$nim_branch` is used here as well, to add the specific compiler to PATH
  - export PATH="$PWD/../nim-$nim_branch/bin${PATH:+:$PATH}"
script:
  # Specify the C compiler to Nim
  # (the `compiler` option of the build matrix sets the `$CC` variable)
  - nimble install -y https://github.com/oswjk/nimpb_protoc
  - nimble build -y --cc:$CC
  # - nim compile --cc:$CC --verbosity:0
cache:
  # Cache both compilers easily
  directories:
    - ../nim-master
    - ../nim-devel
branches:
  except:
    - gh-pages