Skip to content

Commit b4cfb2b

Browse files
hamishforbespintsized
authored andcommitted
Add GH Actions
1 parent fa6b730 commit b4cfb2b

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/test.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
paths-ignore: # Skip if only docs are updated
6+
- '*.md'
7+
8+
jobs:
9+
luacheck:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: leafo/gh-actions-lua@v8
14+
with:
15+
luaVersion: "luajit-openresty"
16+
- uses: leafo/gh-actions-luarocks@v4
17+
- run: luarocks install luacheck
18+
- run: luacheck lib
19+
20+
run_tests:
21+
strategy:
22+
matrix:
23+
openresty_version:
24+
- 1.17.8.1
25+
- 1.19.3.1
26+
27+
runs-on: ubuntu-latest
28+
container:
29+
image: openresty/openresty:${{ matrix.openresty_version }}-alpine-fat
30+
# --init runs tinit as PID 1 and prevents the 'WARNING: killing the child process' spam from the test suite
31+
options: --init
32+
33+
steps:
34+
- name: Install deps
35+
run: |
36+
apk add --no-cache curl perl bash wget git perl-dev libarchive-tools
37+
ln -s /usr/bin/bsdtar /usr/bin/tar
38+
39+
- name: Install CPAN
40+
run: curl -s -L http://xrl.us/cpanm > /bin/cpanm && chmod +x /bin/cpanm
41+
42+
- name: Cache
43+
uses: actions/cache@v2
44+
with:
45+
path: |
46+
~/.cpan
47+
~/.cache
48+
key: ${{ runner.os }}-${{ matrix.openresty_version }}-cache
49+
50+
- name: Install Test::Nginx
51+
run: cpanm -q -n Test::Nginx
52+
53+
- name: Install Luacov
54+
run: luarocks install luacov
55+
56+
- uses: actions/checkout@v2
57+
58+
- name: Run tests
59+
env:
60+
TEST_COVERAGE: '1'
61+
run: /usr/bin/prove -I../test-nginx/lib -r t/
62+
63+
- name: Coverage
64+
run: |
65+
luacov
66+
tail -n 8 luacov.report.out

0 commit comments

Comments
 (0)