Skip to content

Commit 99fc4ef

Browse files
authored
test: add travis CI. (#8)
1 parent 4824d26 commit 99fc4ef

File tree

6 files changed

+57
-4
lines changed

6 files changed

+57
-4
lines changed

.travis.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
os: linux
2+
dist: xenial
3+
4+
sudo: required
5+
6+
addons:
7+
apt:
8+
packages:
9+
- cpanminus
10+
- build-essential
11+
- libncurses5-dev
12+
- libpcre3-dev
13+
- libreadline-dev
14+
- libssl-dev
15+
- perl
16+
- etcd
17+
- luarocks
18+
19+
cache:
20+
directories:
21+
- download-cache
22+
23+
env:
24+
global:
25+
- JOBS=2
26+
- OPENRESTY_PREFIX=/usr/local/openresty
27+
- OPENRESTY_VER=`curl -s "https://api.github.com/repos/openresty/openresty/tags" | grep '"name"' | head -1 | grep -Po '([\d\.]+)'`
28+
29+
install:
30+
- if [ ! -f download-cache/openresty-$OPENRESTY_VER.tar.gz ]; then
31+
wget -P download-cache https://openresty.org/download/openresty-$OPENRESTY_VER.tar.gz;
32+
fi
33+
- git clone https://github.com/openresty/test-nginx.git test-nginx
34+
- sudo luarocks install lua-resty-http
35+
- sudo luarocks install lua-typeof
36+
37+
script:
38+
- cd test-nginx && (sudo cpanm . > build.log 2>&1 || (cat build.log && exit 1)) && cd ..
39+
- tar xzf download-cache/openresty-$OPENRESTY_VER.tar.gz &&
40+
cd openresty-$OPENRESTY_VER
41+
- ./configure --prefix=$OPENRESTY_PREFIX -j$JOBS
42+
> build.log 2>&1 || (cat build.log && exit 1)
43+
- make -j$JOBS > build.log 2>&1 ||
44+
(cat build.log && exit 1)
45+
- sudo make install > build.log 2>&1 ||
46+
(cat build.log && exit 1)
47+
- cd ..
48+
- export PATH=$OPENRESTY_PREFIX/nginx/sbin:$PATH
49+
- sudo service etcd start
50+
- make test jobs=$JOBS

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ help:
1313
@echo Makefile rules:
1414
@echo
1515
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'
16+
17+
test:
18+
prove -I../test-nginx/lib -r -s t/

t/dir.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repeat_each(2);
66

77
our $HttpConfig = <<'_EOC_';
88
lua_socket_log_errors off;
9-
lua_package_path 'lib/?.lua;/usr/share/lua/5.1/?.lua;;';
9+
lua_package_path 'lib/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/share/lua/5.1/?.lua;;';
1010
init_by_lua_block {
1111
function check_res(data, err, val, err_msg, is_dir)
1212
if err then

t/key.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repeat_each(2);
66

77
our $HttpConfig = <<'_EOC_';
88
lua_socket_log_errors off;
9-
lua_package_path 'lib/?.lua;/usr/share/lua/5.1/?.lua;;';
9+
lua_package_path 'lib/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/share/lua/5.1/?.lua;;';
1010
init_by_lua_block {
1111
function check_res(data, err, val, err_msg)
1212
if err then

t/normalize.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repeat_each(2);
55

66
our $HttpConfig = <<'_EOC_';
77
lua_socket_log_errors off;
8-
lua_package_path 'lib/?.lua;/usr/share/lua/5.1/?.lua;;';
8+
lua_package_path 'lib/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/share/lua/5.1/?.lua;;';
99
_EOC_
1010
1111
run_tests();

t/stats.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repeat_each(2);
55

66
our $HttpConfig = <<'_EOC_';
77
lua_socket_log_errors off;
8-
lua_package_path 'lib/?.lua;/usr/share/lua/5.1/?.lua;;';
8+
lua_package_path 'lib/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/share/lua/5.1/?.lua;;';
99
init_by_lua_block {
1010
function check_res(data, err)
1111
if err then

0 commit comments

Comments
 (0)