Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Travis CI for testing on UNIX shell scripts

Background:

I have been using Travis CI for my PHP projects and I really like how they give you a link to a picture that shows the status of the current build of your project.

I am currently making a lot of tools using UNIX shell scripting and would like to use Travis CI to test my UNIX scripts.

I have searched the internet trying to find out how to achieve this. I went to the main website, searched Stackoverflow as well as did a bit of Google searching.

It seems like this isn't possible.

I currently use shunit2 to test my shell scripts and functions.

My question(s) is/are:

  1. Is it possible to use Travis CI to test shell scripts?
  2. If not are there any alternatives that I could use that plug into GitHub?
  3. What is the best way to perform integration testing on shell scripts?
like image 809
Dodzi Dzakuma Avatar asked Dec 08 '13 03:12

Dodzi Dzakuma


People also ask

Can shells support scripting?

The basic steps involved with shell scripting are writing the script, making the script accessible to the shell and giving the shell execute permission. Shell scripts contain ASCII text and are written using a text editor, word processor or graphical user interface (GUI).


2 Answers

Absolutely.

I made a simple test here: https://travis-ci.org/soulseekah/test-shunit2-travis

My .travis.yml file is:

language: bash  before_script:     - curl -L "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz" | tar zx  script:     - bash equality_test.sh 

Repository: https://github.com/soulseekah/test-shunit2-travis

like image 189
soulseekah Avatar answered Sep 28 '22 03:09

soulseekah


I rolled everything into a Makefile and then call make test...

language: bash script: make test 

I'm using assert.sh, so there was no need for the before_script. You can check it out at https://github.com/wmluke/dokku-domains-plugin.

like image 36
wmluke Avatar answered Sep 28 '22 03:09

wmluke