Giter Club home page Giter Club logo

travix's Introduction

Travix - Travis CI helper for Haxe

Build Status

Are you tired of setting up Travis CI for all your projects? Then travix is for you! \o/

  1. Quickstart
  2. Building
  3. Using Travix in your code
  4. Reasons to use Travix
  5. Reasons not to use Travix
  6. How to use git version

Note: Since v0.11.0, Travix only supports Haxe 3.3+. If you need older Haxe, please use v0.10.5.

Quickstart

To use Travix within one of your libs, cd into your project root and execute:

haxelib install travix    # if it's not installed already
haxelib run travix init   # this will ask you to input the necessary information and create a .travis.yml file

From there, the setup should be straight forward.

Building

Travix has individual commands for building:

  • interp - run tests on interpreter
  • neko - run tests on neko
  • node - run tests on nodejs (with hxnodejs)
  • php - run tests on php
  • java - run tests on java
  • js - run tests on phantomjs
  • flash - run tests on flash (see instructions below)
  • python - run tests on python
  • cs - run tests on cs
  • cpp - run tests on cpp
  • lua - run tests on lua
  • hl - run tests on hashlink

So instead of having to have to define all kinds of builds and figuring out the right way to run them, this will do.

Using Travix in your code

There are differences among platforms about logging and exiting the process. For example, we run JS tests on PhantomJS where your test code needs to communicate with the Phantom host in some special ways in order to log or exit the process. And on Flash you need to use flash.Lib.trace and flash.system.System.exit(status).

In order to ease the pain, Travix provides a unified interface for these functionalities. Use them to instead of trace(), Sys.exit(), etc, for maximum compatibility across platforms

  • travix.Logger.print(string): Print a string without newline
  • travix.Logger.println(string): Print a string with newline
  • travix.Logger.exit(exitCode): Exit the process

If you don't want to introduce a hard compile dependency to Travix in your code for some reason, you can also use the travix.Logger in combination with the compile condition #if travix that will result in the travix.Logger being used when executing builds via travix but bypass it when executed without.

For example:

inline function println(v:String)
  #if travix
    travix.Logger.println(v);
  #elseif (flash || air || air3)
    flash.Lib.trace(v);
  #elseif (sys || nodejs)
    Sys.println(v);
  #else
    trace(v);
  #end

The BDD library Buddy has built-in support for flash and JS testing, so if you're using Buddy you don't even have to worry about the above.

Reasons to use Travix

Apart from helping the pathologically lazy to set up a CI, the strength of Travix lies in that it deals with dependencies rather gracefully:

  1. it relies on the haxelib.json to install haxelib dependencies. It also uses the haxelib dev command to "mount" your library as a haxelib, giving you all the extra features, e.g. the presense of your -D libname flag and the inclusion of extraParams.hxml in the build. This happens with the install command.
  2. it follows a fail-fast philosophy. What's that supposed to mean? Normally, in your CI, you will install all dependencies before running any of the tests. If you wait for the installation of hxjava, hxcpp, hxcs, mono and php, only to make your first test abort because of a missing semi-colon or a similarly silly mistake, it can be rather frustrating. To avoid that problem, Travix diverges from the usual modus operandi of having distinct installation and execution phases, and instead installs such dependencies right before execution, e.g. in the cs command.

Reasons not to use Travix

The motivation behind Travix is to be able to spin up CI setups quickly, for many small libraries (in my case the tink libs). It is very likely, that it will not scale up to bigger projects, particularly when multiple builds need to be run in unison to have a test. If you have suggestions - or better yet: pull requests - to make Travix more useful for such cases, you are highly welcome.

How to use git version

In your .travis.yml simply replace haxelib install travix with the following:

haxelib git travix https://github.com/back2dos/travix && pushd . && cd $(haxelib config)travix/git && haxe build-neko.hxml && popd

travix's People

Contributors

kevinresol avatar back2dos avatar ciscoheat avatar sebthom avatar andyli avatar fponticelli avatar

Watchers

James Cloos avatar David Klein avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.