Skip to content

Commit

Permalink
[ci] Add code coverage and upload to coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
devkapilbansal committed Jul 12, 2021
1 parent 88bbcd6 commit 7ded897
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ jobs:
- name: Tests
run: ./runtests

- name: Upload Coverage
run: luacov-coveralls -o openwrt-openwisp-monitoring/tests/luacov.stats.out -v
env:
COVERALLS_REPO_TOKEN: ${{ github.token }}

build:
name: Build and upload package as artifacts
needs: tests
Expand Down
2 changes: 2 additions & 0 deletions install-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ luarocks install luaunit
luarocks install luacheck
# install lua-cjson
luarocks install lua-cjson
#install luacov-coveralls
luarocks install luacov-coveralls
#clean
rm -rf json-c libubox uci
6 changes: 6 additions & 0 deletions openwrt-openwisp-monitoring/tests/.luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return {
['exclude'] = {
'luaunit$'
},
statsfile="../../luacov.stats.out"
}
File renamed without changes.
2 changes: 1 addition & 1 deletion openwrt-openwisp-monitoring/tests/test_dhcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local luaunit = require('luaunit')

TestDhcp = {
setUp = function()
local env = require('env1')
local env = require('main_env')
package.loaded.uci = env.uci
package.loaded.io = env.io
end,
Expand Down
2 changes: 1 addition & 1 deletion openwrt-openwisp-monitoring/tests/test_interfaces.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local interface_data = require('test_files/interface_data')

TestInterface = {
setUp = function()
local env = require('env1')
local env = require('main_env')
package.loaded.uci = env.uci
package.loaded.ubus = env.ubus
package.loaded.io = env.io
Expand Down
2 changes: 1 addition & 1 deletion openwrt-openwisp-monitoring/tests/test_neighbors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local neighbor_data = require('test_files/neighbors_data')

TestNeighbor = {
setUp = function()
local env = require('env1')
local env = require('main_env')
package.loaded.io = env.io
end,
tearDown = function()
Expand Down
2 changes: 1 addition & 1 deletion openwrt-openwisp-monitoring/tests/test_resources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local resources_data = require('test_files/resources_data')

TestResources = {
setUp = function()
local env = require('env1')
local env = require('main_env')
package.loaded.io = env.io
end,
tearDown = function()
Expand Down
13 changes: 7 additions & 6 deletions runtests
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
set -e

cd openwrt-openwisp-monitoring/tests/
lua test_dhcp.lua -v
lua test_interfaces.lua -v
lua test_utils.lua -v
lua test_neighbors.lua -v
lua test_resources.lua -v
lua test_wifi.lua -v
# run tests
lua -lluacov test_dhcp.lua -v
lua -lluacov test_interfaces.lua -v
lua -lluacov test_utils.lua -v
lua -lluacov test_neighbors.lua -v
lua -lluacov test_resources.lua -v
lua -lluacov test_wifi.lua -v

0 comments on commit 7ded897

Please sign in to comment.