Search code examples
travis-cimultilingualmulti-module

Travis-ci file for multi-module multi-language project


Is there a way to setup travis-ci to build multiple projects in different languages ?

Lets say my repo is

AwesomeRepoThatDoestOneThingInDifferentLanguages
-cpp
-csharp
-python2
-python3
-java
-go
-ruby
-lua
-objectivec

Now, I wish to apply ci to this. If I just add .travis.yml file to my python2 project, travis-ci complains that no .travis.yml found, since its looking for one at the root of the repo. So, is there a way where I can put a .travis.yml at the top, which then further invokes the travis.yml in each of my sub-modules ?


Solution

  • I was able to find a way to actually do this. This is not complete yet since some of the jobs are still failing and I need to fix them individually, but overall the idea works just fine. I am using travis ci's matrix way. Here is my .travis.yml Thought this might help if someone else had the same question or scenario.

    ---
    matrix:
      include:
        -
          before_script:
            - "cd java"
          jdk: oraclejdk8
          language: java
          script: "mvn clean package"
        -
          before_script:
            - "cd python2"
            - "pip install --upgrade setuptools"
            - "pip install nose"
            - "pip freeze > requirements.txt"
            - "pip install -r requirements.txt"
            - "cd tests"
          cache: pip
          language: python
          python: 2.7
          script: nosetests
        -
          before_script:
            - "cd python3"
            - "pip install --upgrade setuptools"
            - "pip install nose"
            - "pip freeze > requirements.txt"
            - "pip install -r requirements.txt"
            - "cd tests"
          language: python
          python: 3.6
          script: nosetests
        -
          before_script:
            - "cd objectivec"
          language: objective-c
          os: osx
          osx_image: xcode10
          script:
            - "xcodebuild clean test -project DiffMatchPatch.xcodeproj -scheme DiffMatchPatch -destination 'platform=OS X,arch=x86_64'"
    
        -
          before_script:
            - "sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa"
            - "sudo apt-get update -qq"
            - "sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev"
          language: cpp
          script:
            - "qmake -qt=qt5 -v"
            - "qmake -qt=qt5"
            - make
        -
          before_script:
            - "cd csharp"
          dotnet: "1.1.5"
          env: DOTNETCORE=1
          language: csharp
          mono: latestscript
          script:
            - "dotnet restore"
          solution: solution-name.sln
        -
          before_script:
            - "cd dart"
          dart: "1.15.0"
          dart_task:
            -
              test: "--exclude-tags no-xvfb"
            -
              test: "--tags no-xvfb"
          language: dart
          with_content_shell: true
        -
          after_success:
            - coveralls -b .. -r .. -i ./lua --dump c.report.json
            - luacov-coveralls -j c.report.json -v
          before_install:
            - "cd lua"
            - "pip install --upgrade pip"
            - "pip install --upgrade setuptools"
            - "pip freeze > requirements.txt"
            - "pip install -r requirements.txt"
            - "sudo wget https://luarocks.org/releases/luarocks-2.4.4.tar.gz"
            - "sudo tar zxpf luarocks-2.4.4.tar.gz"
            - "cd luarocks-2.4.4"
            - "./configure --prefix=/usr/local/openresty/luajit \
               --with-lua=/usr/local/openresty/luajit \
               --lua-suffix=jit-2.1.0-beta2 \
               --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1; sudo make bootstrap"
            - "sudo luarocks install luasocket"
            - "pip install cpp-coveralls"
            - "luarocks install Lua-cURL  --server=https://luarocks.org/dev"
            - "luarocks install luacov-coveralls --server=https://luarocks.org/dev"
            - "luarocks install lunitx"
            - "luarocks install luabitop"
          language: python
          script:
            - "lunit.sh tests/diff_match_patch_test.lua"
            - "lunit.sh tests/speedtest.lua"
    notifications:
      email:
        - 
    sudo: required