1language: generic
2sudo: required
3dist: trusty
4
5services:
6    - docker
7
8matrix:
9  fast_finish: true
10
11  include:
12    - os: linux
13      addons:
14        apt:
15          sources:
16              - ubuntu-toolchain-r-test
17              - sourceline: 'ppa:webupd8team/java'
18          packages: ['g++-6', 'cmake', 'python3', 'python3-pip', 'python3-setuptools', 'nodejs', 'npm', 'libsfml-dev', 'libprotobuf-dev', 'protobuf-compiler', 'libzmq-dev']
19      env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6'
20
21    - os: linux
22      addons:
23        apt:
24          sources:
25              - ubuntu-toolchain-r-test
26              - sourceline: 'ppa:webupd8team/java'
27          packages: ['g++-5', 'cmake', 'python3', 'python3-pip', 'python3-setuptools', 'nodejs', 'npm', 'libsfml-dev', 'libprotobuf-dev', 'protobuf-compiler', 'libzmq-dev']
28      env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5'
29
30    - os: linux
31      addons:
32        apt:
33          sources:
34              - llvm-toolchain-trusty-3.9
35              - sourceline: 'ppa:webupd8team/java'
36          packages: ['clang-3.9', 'cmake', 'python3', 'python3-pip', 'python3-setuptools', 'nodejs', 'npm', 'libsfml-dev', 'libprotobuf-dev', 'protobuf-compiler', 'libzmq-dev']
37      env: CCOMPILER='clang-3.9' CXXCOMPILER='clang++-3.9'
38
39    - os: linux
40      addons:
41        apt:
42          sources:
43              - llvm-toolchain-trusty-4.0
44              - sourceline: 'ppa:webupd8team/java'
45          packages: ['clang-4.0', 'cmake', 'python3', 'python3-pip', 'python3-setuptools', 'nodejs', 'npm', 'libsfml-dev', 'libprotobuf-dev', 'protobuf-compiler', 'libzmq-dev']
46      env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0'
47
48    - os: osx
49      osx_image: xcode8.2
50      node_js: 4
51      env: CCOMPILER='clang' CXXCOMPILER='clang++'
52
53    - os: osx
54      osx_image: xcode8.2
55      node_js: 6
56      env: CCOMPILER='clang' CXXCOMPILER='clang++'
57
58before_install:
59  - export CC=${CCOMPILER} CXX=${CXXCOMPILER}
60  - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10; fi
61  - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew update && brew install python3 && brew cask install java; fi
62
63install:
64  # Make sure building libsweep works
65  - pushd libsweep
66  - mkdir -p build
67  - cd build
68  - cmake .. -DCMAKE_BUILD_TYPE=Debug
69  - cmake --build .
70  # Then build and install dummy library to test bindings against without device attached
71  - cmake .. -DCMAKE_BUILD_TYPE=Debug -DDUMMY=On
72  - cmake --build .
73  - sudo cmake --build . --target install
74  - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo ldconfig; fi
75  - popd
76  # Install Python bindings
77  - pushd sweeppy
78  - sudo python2 setup.py install
79  - sudo python3 setup.py install
80  - popd
81  # Build Java Bindings
82  - ./travis/java-run-task.sh assemble
83
84script:
85  # Test libsweep examples against the dummy library
86  - pushd libsweep/examples
87  - mkdir build
88  - cd build
89  - cmake ..
90  - cmake --build .
91  - ./example-c /dev/ttyUSB0
92  - ./example-c++ /dev/ttyUSB0
93  - popd
94  # Test SweepPy bindings against the dummy library
95  - pushd sweeppy
96  - python2 -m sweeppy /dev/ttyUSB0
97  - python3 -m sweeppy /dev/ttyUSB0
98  - popd
99  # Test SweepJs bindings against the dummy library
100  - pushd sweepjs
101  - npm install
102  - popd
103  # Test JSweep bindings against the dummy library
104  - ./travis/java-run-task.sh check
105