add travis
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..fc3d7d4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,11 @@
+sudo: required
+services:
+ - docker
+
+install:
+ - bundle install
+ #- sudo pip install gitshelf
+ #- gitshelf install
+
+script:
+ - kitchen test
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..90097af
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,11 @@
+source 'https://rubygems.org'
+
+gem 'test-kitchen'
+gem 'kitchen-docker'
+gem 'kitchen-inspec'
+gem 'kitchen-sync'
+gem 'inspec'
+#gem 'kitchen-salt', path: '../../../../..//workspace-ruby/kitchen-salt'
+gem 'kitchen-salt', 'dependencis-pkg-repo2' git: 'https://github.com/epcim/kitchen-salt.git'
+
+# vi: set ft=ruby :
diff --git a/Makefile b/Makefile
index fc83783..a75814b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,28 @@
DESTDIR=/
SALTENVDIR=/usr/share/salt-formulas/env
RECLASSDIR=/usr/share/salt-formulas/reclass
-FORMULANAME=$(shell grep name: metadata.yml|head -1|cut -d : -f 2|grep -Eo '[a-z0-9\-]*')
+FORMULANAME=$(shell grep name: metadata.yml|head -1|cut -d : -f 2|grep -Eo '[a-z0-9\-\_]*')
+
+MAKE_PID := $(shell echo $$PPID)
+JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$(MAKE)")))
+
+ifneq ($(subst -j,,$(JOB_FLAG)),)
+JOBS := $(subst -j,,$(JOB_FLAG))
+else
+JOBS := 1
+endif
+
+KITCHEN_LOCAL_YAML?=.kitchen.yml
+KITCHEN_OPTS?="--concurrency=$(JOBS)"
+KITCHEN_OPTS_CREATE?=""
+KITCHEN_OPTS_CONVERGE?=""
+KITCHEN_OPTS_VERIFY?=""
+KITCHEN_OPTS_TEST?=""
all:
@echo "make install - Install into DESTDIR"
@echo "make test - Run tests"
+ #@echo "make kitchen - Run Kitchen CI tests (create, converge, verify)"
@echo "make clean - Cleanup after tests run"
install:
@@ -21,6 +38,29 @@
test:
[ ! -d tests ] || (cd tests; ./run_tests.sh)
+kitchen: kitchen-create kitchen-converge kitchen-verify kitchen-list
+
+kitchen-create:
+ kitchen create ${KITCHEN_OPTS} ${KITCHEN_OPTS_CREATE}
+ [ "$(shell echo $(KITCHEN_LOCAL_YAML)|grep -Eo docker)" = "docker" ] || sleep 120
+
+kitchen-converge:
+ kitchen converge ${KITCHEN_OPTS} ${KITCHEN_OPTS_CONVERGE} &&\
+ kitchen converge ${KITCHEN_OPTS} ${KITCHEN_OPTS_CONVERGE}
+
+kitchen-verify:
+ [ ! -d tests/integration ] || kitchen verify -t tests/integration ${KITCHEN_OPTS} ${KITCHEN_OPTS_VERIFY}
+ [ -d tests/integration ] || kitchen verify ${KITCHEN_OPTS} ${KITCHEN_OPTS_VERIFY}
+
+kitchen-test:
+ [ ! -d tests/integration ] || kitchen test -t tests/integration ${KITCHEN_OPTS} ${KITCHEN_OPTS_TEST}
+ [ -d tests/integration ] || kitchen test ${KITCHEN_OPTS} ${KITCHEN_OPTS_TEST}
+
+kitchen-list:
+ kitchen list
+
clean:
+ [ ! -x "$(shell which kitchen)" ] || kitchen destroy
+ [ ! -d .kitchen ] || rm -rf .kitchen
[ ! -d tests/build ] || rm -rf tests/build
[ ! -d build ] || rm -rf build
diff --git a/metadata.yml b/metadata.yml
index 1d17a61..6dbf7fc 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -3,4 +3,4 @@
source: "https://github.com/tcpcloud/salt-formula-git"
dependencies:
- name: linux
- source: "https://github.com/tcpcloud/salt-formula-linux"
\ No newline at end of file
+ source: "https://github.com/tcpcloud/salt-formula-linux"