Set up automatic testing in Github repository

This is my post documenting how to set up automatic testing for Github repository.

Credits to Ajay who actually did it. I am mostly documenting the steps he did. The motivation was that it became unsustainable for me to manually run tests everytime a pull request comes in.

Go to Travis CI, sign up and link to the Github repository. (The full Getting Started link is here https://docs.travis-ci.com/user/getting-started/)

The key thing is to put a “.travis.yml” file in the root of the directory

There seems to be a myriad of functionalities (supporting different programming languages etc), but it seems to be the easiest to use the generic one

 

os:
        - linux

language: generic

install:
        - wget https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.tar.gz -O cmake.tar.gz
        - tar xvf cmake.tar.gz
        - mv cmake-3.12.1-Linux-x86_64 cmake
script:
        - mkdir build
        - cd build
        - ../cmake/bin/cmake ..
        - make
        - cd bin 
        - ./graphit_test
        - cd ..
        - python python_tests/test.py
        - python python_tests/test_with_schedules.py

 

The script generally have 2 parts, “install” and “script”. Install uses wget to get all the dependencies. In the ¬†“script” part, we set up the build directory, and run the python tests.

Another one that uses the c++ language from the Tiramisu project

language: cpp

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - libstdc++-4.9-dev

install:
  - wget http://llvm.org/releases/5.0.0/clang+llvm-5.0.0-x86_64-linux-gnu-debian8.tar.xz
  - tar xvf clang+llvm-5.0.0-x86_64-linux-gnu-debian8.tar.xz
  - mv clang+llvm-5.0.0-x86_64-linux-gnu-debian8 llvm
  - ./utils/scripts/install_submodules.sh $TRAVIS_BUILD_DIR $TRAVIS_BUILD_DIR/llvm/bin
  - printf "\nset (LLVM_CONFIG_BIN \${CMAKE_SOURCE_DIR}/llvm/bin)" >> configure.cmake

script:
  - mkdir build
  - cd build
  - cmake ..
  - make -j tiramisu
  - make test

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s