From af39a2c97ea01de6a1451071e58d4fce8f4b9d03 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Fri, 17 Mar 2017 15:46:01 +0100
Subject: [PATCH] Implement Travis CI. Closes #8

---
 .travis.yml    | 17 +++++++++++++++++
 Makefile       | 11 +++++++++++
 success.sh     |  4 ++++
 test/runtest.m |  8 ++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 .travis.yml
 create mode 100644 Makefile
 create mode 100755 success.sh

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..8be4a07
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,17 @@
+language: python
+
+git:
+  depth: 1
+
+dist: trusty
+
+install:
+  - export
+  - sudo add-apt-repository ppa:octave/stable -y
+  - sudo apt-get update -qq
+  - sudo apt-get install -qq octave liboctave-dev texlive texlive-latex-recommended  texlive-latex-extra
+  - git clone --depth=1 --recursive --branch=master https://github.com/DynareTeam/dynare.git ~/builds/dynare
+
+script:
+  - make check-octave
+  - ./success.sh
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7ca3b08
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+OCTAVE=octave-cli
+MATLAB=`which matlab`
+
+all: check-octave check-matlab
+
+check-octave:
+	@cd test ;\
+	$(OCTAVE) --silent --no-history runtest.m
+
+check-matlab:
+	@$(MATLAB) -nosplash -nodisplay -r "cd test; runtest; quit"
diff --git a/success.sh b/success.sh
new file mode 100755
index 0000000..8437309
--- /dev/null
+++ b/success.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+if [ ! -f test/report.pdf ]; then
+    exit 1;
+fi
diff --git a/test/runtest.m b/test/runtest.m
index f92ac68..8a8e00c 100644
--- a/test/runtest.m
+++ b/test/runtest.m
@@ -1,3 +1,11 @@
+addpath('~/builds/dynare/matlab/utilities/general')
+addpath('~/builds/dynare/matlab/modules/dates/src')
+addpath('~/builds/dynare/matlab/modules/dseries/src')
+addpath('../src')
+
+initialize_dates_toolbox;
+initialize_dseries_toolbox;
+
 db_a = dseries('db_a.csv');
 db_q = dseries('db_q.csv');
 dc_a = dseries('dc_a.csv');
-- 
GitLab