Merge pull request #41 from tuncer/ci-dialyze

diff --git a/.travis.yml b/.travis.yml
index 2a22a3a..5c35a31 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,24 @@
+sudo: false
 language: erlang
 otp_release:
-   - 19.0
-   - 18.3
-   - 17.3
-   - 17.1
-   - 17.0
-   - R16B03
-   - R15B03
-   - R16B03-1
-   - R16B02
-   - R16B01
+  - 20.1.5
+  - 20.0.4
+  - 19.0
+  - 18.3
+  - 17.3
+  - 17.1
+  - 17.0
+  - R16B03-1
+  - R15B03
+env: MAKE_TARGET=ci
+matrix:
+  include:
+    - otp_release: 20.1.5
+      env: MAKE_TARGET=ci-dialyze
+script: make $MAKE_TARGET
+cache:
+  directories:
+    - .rebar
+before_cache:
+  - rm -fv .rebar/erlcinfo
+  - rm -fv $HOME/.cache/.rebar/erlcinfo
diff --git a/Makefile b/Makefile
index 54e97ea..058a502 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,11 @@
 all:
 	./rebar compile
 
-test: eunit qc
+test: xref eunit qc
+
+ci: clean debug test
+
+ci-dialyze: clean debug dialyze
 
 doc:
 	./rebar doc
@@ -27,11 +31,17 @@
 clean:
 	./rebar clean
 
-dialyzer:
-	./rebar analyze
+xref:
+	./rebar xref
 
 eunit:
 	./rebar eunit
 
 qc:
 	./rebar qc
+
+maybe_build_plt:
+	./rebar -vv check-plt || ./rebar -vv build-plt
+
+dialyze: maybe_build_plt
+	./rebar -vv dialyze