Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ledgetech/lua-resty-http
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.14
Choose a base ref
...
head repository: ledgetech/lua-resty-http
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: pintsized
66 changes: 66 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Test

on: [push, pull_request]

jobs:
luacheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: leafo/gh-actions-lua@v8
with:
luaVersion: "luajit-openresty"
- uses: leafo/gh-actions-luarocks@v4
- run: luarocks install luacheck
- run: luacheck lib

run_tests:
strategy:
matrix:
openresty_version:
- 1.17.8.2
- 1.19.9.1
- 1.21.4.3
- 1.25.3.1

runs-on: ubuntu-latest
container:
image: openresty/openresty:${{ matrix.openresty_version }}-alpine-fat
# --init runs tinit as PID 1 and prevents the 'WARNING: killing the child process' spam from the test suite
options: --init

steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
apk add --no-cache curl perl bash wget git perl-dev libarchive-tools nodejs
ln -s /usr/bin/bsdtar /usr/bin/tar
- name: Install CPAN
run: curl -s -L http://xrl.us/cpanm > /bin/cpanm && chmod +x /bin/cpanm

- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cpan
~/.cache
key: ${{ runner.os }}-${{ matrix.openresty_version }}-cache

- name: Install Test::Nginx
run: cpanm -q -n Test::Nginx

- name: Install Luacov
run: |
/usr/local/openresty/luajit/bin/luarocks install luacov
/usr/local/openresty/luajit/bin/luarocks install lua-resty-openssl
- uses: actions/checkout@v2

- name: Run tests
run: make coverage

- name: Coverage
run: |
luacov
tail -n 8 luacov.report.out
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
t/servroot/
t/error.log
lua-resty-http*
luacov*
lua-resty-http-*/
lua-resty-http-*.src.rock
lua-resty-http-*.tar.gz
5 changes: 5 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
modules = {
["http"] = "lib/resty/http.lua",
["http_headers"] = "lib/resty/http_headers.lua",
["http_connect"] = "lib/resty/http_connect.lua",
}
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
OPENRESTY_PREFIX=/usr/local/openresty

PREFIX ?= /usr/local
PREFIX ?= /usr/local
LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
INSTALL ?= install
TEST_FILE ?= t
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
INSTALL ?= install
TEST_FILE ?= t

export PATH := $(OPENRESTY_PREFIX)/nginx/sbin:$(PATH)
PROVE=TEST_NGINX_NO_SHUFFLE=1 prove -I../test-nginx/lib -r $(TEST_FILE)

# Keep in sync with .luacov, so that we show the right amount of output
LUACOV_NUM_MODULES ?= 3

.PHONY: all test install

@@ -15,14 +21,13 @@ install: all
$(INSTALL) lib/resty/*.lua $(DESTDIR)/$(LUA_LIB_DIR)/resty/

test: all
PATH=$(OPENRESTY_PREFIX)/nginx/sbin:$$PATH TEST_NGINX_NO_SHUFFLE=1 prove -I../test-nginx/lib -r $(TEST_FILE)
$(PROVE)

coverage: all
-@echo "Cleaning stats"
@rm -f luacov.stats.out
PATH=$(OPENRESTY_PREFIX)/nginx/sbin:$$PATH TEST_NGINX_NO_SHUFFLE=1 TEST_COVERAGE=1 prove -I../test-nginx/lib -r $(TEST_FILE)
TEST_COVERAGE=1 $(PROVE)
@luacov
@tail -10 luacov.report.out
@tail -$$(( $(LUACOV_NUM_MODULES) + 5)) luacov.report.out

check:
luacheck lib
Loading