Merge pull request #22 from alexsong93/concourse
Add Concourse CI PR pipeline
diff --git a/.gitignore b/.gitignore
index bbb2fb9..d0a944a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@
*.swp
*.swo
+# Concourse
+secrets.yml
diff --git a/api-gateway-config/tests/install-deps.sh b/api-gateway-config/tests/install-deps.sh
index d44356a..5f9d12d 100755
--- a/api-gateway-config/tests/install-deps.sh
+++ b/api-gateway-config/tests/install-deps.sh
@@ -1,13 +1,13 @@
-#!/bin/bash
+#!/bin/sh
# Install global dependencies
luarocks install busted
luarocks install luacov
# Install test dependencies
mkdir -p lua_modules
-luarocks install --tree lua_modules lua-cjson
-luarocks install --tree lua_modules luabitop
-luarocks install --tree lua_modules luasocket
-luarocks install --tree lua_modules sha1
-luarocks install --tree lua_modules md5
-luarocks install --tree lua_modules fakeredis
\ No newline at end of file
+luarocks install --tree=lua_modules lua-cjson
+luarocks install --tree=lua_modules luabitop
+luarocks install --tree=lua_modules luasocket
+luarocks install --tree=lua_modules sha1
+luarocks install --tree=lua_modules md5
+luarocks install --tree=lua_modules fakeredis
diff --git a/api-gateway-config/tests/run-tests.sh b/api-gateway-config/tests/run-tests.sh
index 7d27b35..6e137da 100755
--- a/api-gateway-config/tests/run-tests.sh
+++ b/api-gateway-config/tests/run-tests.sh
@@ -1,9 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Run unit tests
-busted -c --output=TAP --helper=set_paths spec/test.lua
-
-# Generate code coverage report
-luacov ../scripts/lua/
-cat luacov.report.out
-rm luacov.report.out && rm luacov.stats.out
\ No newline at end of file
+busted -c --output=TAP --helper=set_paths spec/test.lua
\ No newline at end of file
diff --git a/api-gateway-config/tests/spec/test.lua b/api-gateway-config/tests/spec/test.lua
index b3e88a0..89e7052 100644
--- a/api-gateway-config/tests/spec/test.lua
+++ b/api-gateway-config/tests/spec/test.lua
@@ -231,6 +231,7 @@
redis.deleteSubscription(red, key)
assert.are.equal(false, red:exists(key))
end)
+
end)
--TODO: filemgmt
@@ -240,8 +241,3 @@
---------------------------------------
--TODO: mapping, rateLimit, security
-describe('Testing mapping module', function()
- before_each(function()
- _G.ngx = fakengx.new()
- end)
-end)
diff --git a/concourse/pipeline.yml b/concourse/pipeline.yml
new file mode 100644
index 0000000..83c0bc1
--- /dev/null
+++ b/concourse/pipeline.yml
@@ -0,0 +1,37 @@
+---
+jobs:
+ - name: PR unit tests
+ public: true
+ serial: true
+ plan:
+ - get: apigateway
+ trigger: true
+ - put: apigateway
+ params:
+ path: apigateway
+ status: pending
+ - task: run-unit-tests
+ file: apigateway/concourse/tasks/run-unit-tests.yml
+ on_success:
+ put: apigateway
+ params:
+ path: apigateway
+ status: success
+ on_failure:
+ put: apigateway
+ params:
+ path: apigateway
+ status: failure
+
+resource_types:
+ - name: pull-request
+ type: docker-image
+ source:
+ repository: jtarchie/pr
+
+resources:
+ - name: apigateway
+ type: pull-request
+ source:
+ repo: openwhisk/apigateway
+ access_token: {{access_token}}
diff --git a/concourse/tasks/run-unit-tests.sh b/concourse/tasks/run-unit-tests.sh
new file mode 100755
index 0000000..015b307
--- /dev/null
+++ b/concourse/tasks/run-unit-tests.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+apk add --update git
+
+cd apigateway/api-gateway-config/tests
+./install-deps.sh
+./run-tests.sh
\ No newline at end of file
diff --git a/concourse/tasks/run-unit-tests.yml b/concourse/tasks/run-unit-tests.yml
new file mode 100644
index 0000000..b5a0291
--- /dev/null
+++ b/concourse/tasks/run-unit-tests.yml
@@ -0,0 +1,12 @@
+---
+platform: linux
+
+image_resource:
+ type: docker-image
+ source: {repository: abaez/luarocks, tag: lua5.1}
+
+inputs:
+ - name: apigateway
+
+run:
+ path: apigateway/concourse/tasks/run-unit-tests.sh