Skip to content

Commit 9603c81

Browse files
committed
Added coverage support
1 parent 7c5c71d commit 9603c81

File tree

8 files changed

+127
-8
lines changed

8 files changed

+127
-8
lines changed

.travis.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
language: erlang
2+
3+
env:
4+
global:
5+
- PLATFORM=linux
6+
- LUAROCKS_VER=2.2.0beta1
7+
matrix:
8+
- LUA=lua5.1
9+
- LUA=lua5.2
10+
- LUA=luajit
11+
212
branches:
313
only:
414
- master
515

6-
env:
7-
- LUA=""
8-
- LUA="luajit"
9-
10-
install:
11-
- sudo apt-get install luajit
12-
- sudo apt-get install luarocks
13-
- sudo luarocks install telescope
16+
before_install:
17+
- bash .travis/setup_lua.sh
18+
- sudo luarocks install telescope 0.6.0 --server=http://rocks.moonscript.org
19+
- sudo luarocks install luacov-coveralls --server=http://rocks.moonscript.org/dev
1420

1521
script: "tsc -f specs/*"
22+
23+
after_success:
24+
- luacov-coveralls -c specs/.luacov
25+
26+
notifications:
27+
email:
28+
on_success: change
29+
on_failure: always

.travis/setup_lua.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#! /bin/bash
2+
# A script for setting up environment for travis-ci testing.
3+
# Sets up Lua and Luarocks.
4+
# LUA must be "lua5.1", "lua5.2" or "luajit".
5+
# PLATFORM must be "linux" or "macosx".
6+
# Original written by Alexey Melnichuk <https://github.com/moteus>
7+
8+
if [ "$LUA" == "luajit" ]; then
9+
curl http://luajit.org/download/LuaJIT-2.0.2.tar.gz | tar xz
10+
cd LuaJIT-2.0.2
11+
make && sudo make install
12+
sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua
13+
cd $TRAVIS_BUILD_DIR;
14+
else
15+
if [ "$LUA" == "lua5.1" ]; then
16+
curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
17+
cd lua-5.1.5;
18+
elif [ "$LUA" == "lua5.2" ]; then
19+
curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz
20+
cd lua-5.2.3;
21+
fi
22+
sudo make $PLATFORM install
23+
cd $TRAVIS_BUILD_DIR;
24+
fi
25+
26+
LUAROCKS_BASE=luarocks-$LUAROCKS_VER
27+
curl http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz
28+
cd $LUAROCKS_BASE;
29+
30+
if [ "$LUA" == "luajit" ]; then
31+
./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0;
32+
else
33+
./configure;
34+
fi
35+
36+
make build && sudo make install
37+
38+
cd $TRAVIS_BUILD_DIR
39+
40+
rm -rf $LUAROCKS_BASE
41+
42+
if [ "$LUA" == "luajit" ]; then
43+
rm -rf LuaJIT-2.0.2;
44+
elif [ "$LUA" == "lua5.1" ]; then
45+
rm -rf lua-5.1.5;
46+
elif [ "$LUA" == "lua5.2" ]; then
47+
rm -rf lua-5.2.3;
48+
fi

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Delaunay
22
=====
33

44
[![Build Status](https://travis-ci.org/Yonaba/delaunay.png)](https://travis-ci.org/Yonaba/delaunay)
5+
[![Coverage Status](https://coveralls.io/repos/Yonaba/delaunay/badge.png?branch=master)](https://coveralls.io/r/Yonaba/delaunay?branch=master)
6+
[![License](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE)
57

68
*delaunay* is a Lua module for [delaunay triangulation](http://en.wikipedia.org/wiki/Delaunay_triangulation) of a convex polygon.
79

specs/.luacov

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
--- Global configuration file. Copy, customize and store in your
2+
-- project folder as '.luacov' for project specific configuration
3+
-- @class module
4+
-- @name luacov.defaults
5+
return {
6+
7+
-- default filename to load for config options if not provided
8+
-- only has effect in 'luacov.defaults.lua'
9+
["configfile"] = ".luacov",
10+
11+
-- filename to store stats collected
12+
["statsfile"] = "luacov.stats.out",
13+
14+
-- filename to store report
15+
["reportfile"] = "luacov.report.json",
16+
17+
-- Run reporter on completion? (won't work for ticks)
18+
runreport = false,
19+
20+
-- Delete stats file after reporting?
21+
deletestats = false,
22+
23+
-- Patterns for files to include when reporting
24+
-- all will be included if nothing is listed
25+
-- (exclude overrules include, do not include
26+
-- the .lua extension)
27+
["include"] = {
28+
},
29+
30+
-- Patterns for files to exclude when reporting
31+
-- all will be included if nothing is listed
32+
-- (exclude overrules include, do not include
33+
-- the .lua extension)
34+
["exclude"] = {
35+
'tsc',
36+
'telescope',
37+
'loader',
38+
},
39+
40+
-- configuration for luacov-coveralls reporter
41+
["coveralls"] = {
42+
43+
-- ["debug"] = true;
44+
45+
["pathcorrect"] = {
46+
{"/usr/local/share/lua/5.[12]", "src/lua"};
47+
},
48+
49+
},
50+
51+
}

specs/delaunay.lua

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'luacov'
12
local Delaunay = (require "delaunay")
23
local Point = Delaunay.Point
34
local Triangle = Delaunay.Triangle

specs/edge.lua

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'luacov'
12
local Point = (require "delaunay").Point
23
local Edge = (require "delaunay").Edge
34

specs/point.lua

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'luacov'
12
local Point = (require "delaunay").Point
23

34
context("Point", function()

specs/triangle.lua

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'luacov'
12
local make_assertion = (require "telescope").make_assertion
23
local Point = (require "delaunay").Point
34
local Edge = (require "delaunay").Edge

0 commit comments

Comments
 (0)