Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run 2 seperate .travis.yml files from the same github repository

My current use case is that I use travis-ci very happily to run my test cases for a python project. This reports a fail or pass based on whether the py.unit tests pass.

I would like to add pep8 checking to this repository as well, but I don't want my core functionality tests to fail if there is some incorrectly formatted code, but I would like to know about it.

Any possible ways of dealing with this would be useful, but my immediate thought was, is there any way of having 2 separate test runners, running off the same repository? ".travis.yml" running the main tests, and a separate process monitoring my pep8 compliance from ".travis2.yml" for example.

I would then have 2 jobs running, and could see if my core functionality tests are still OK at a glance(from the github badge for example), but also how my pep8 compliance is going.

Thanks

Mark

like image 841
Mark Avatar asked Sep 24 '15 15:09

Mark


People also ask

What does Travis Yml file do?

travis. yml is a configuration file, which provides instructions to the testing and building software on how to run tests and build any files required by the project. This file is part of the repository's git repository.

How do I trigger a Travis build on github?

Trigger Travis CI builds using the API V3 by sending a POST request to /repo/{slug|id}/requests : Get an API token from your Travis CI settings page. You'll need the token to authenticate most of these API requests.

Which of the following type of commands are supported by Travis CLI?

There are three types of commands: Non-API Commands, General API Commands and Repository Commands. All commands take the form of travis COMMAND [ARGUMENTS] [OPTIONS] .


1 Answers

From http://docs.travis-ci.com/user/customizing-the-build/ :

Travis CI uses .travis.yml file in the root of your repository to learn about your project and how you want your builds to be executed.

A mixture of matrix and allow_failurescould be used in the single .travis.yml file to address your use case of having two jobs run where one build reports your functionality tests and a second build gives you feedback on your pep8 compliance,

For example, the following .travis.yml file cause two builds to occur on traivs. In only one of the builds (i.e. where PEP=true), the pep8 check would occur. If the pep8-check failed it wouldn't be considered a failure due to allow_failures:

language: python

env:
  - PEP=true
  - PEP=false
matrix:
  allow_failures:
    - env: PEP=true
script:
  - if $PEP ; then pep8 ; fi
  - python -m unittest discover
like image 141
nfranklin Avatar answered Sep 28 '22 23:09

nfranklin