env: TRAVIS_CI=true
language: c

compiler:
  - gcc
  - clang

install:
  # for unit tests
  - sudo apt-get install -y check
  - sudo apt-get install -y libsubunit-dev
  # for static code analysis
  # - sudo apt-get install -y cppcheck
  # - sudo apt-get install -y rats
  # for test code coverage
  - sudo apt-get install -y lcov
  - gem install coveralls-lcov

before_script:
  - cd ${TRAVIS_BUILD_DIR}
  - lcov --directory . --zerocounters

script:
  # - find . -type f -name "*.c" -print | grep -v t\/ | xargs cppcheck 2>&1
  # - find . -type f -name "*.c" -print | grep -v t\/ | xargs rats --language=c
  - git clone --depth 100 https://github.com/proftpd/proftpd.git
  - cp mod_autohost.c proftpd/contrib/
  - cd proftpd/
  - ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel=coverage --enable-dso --enable-tests --with-shared=mod_autohost
  - make
  - make clean
  - ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel=coverage --enable-tests --with-modules=mod_autohost
  - make
