Repository navigation
91 lines (79 loc) · 2.54 KB
/
Copy pathtest.yml
File metadata and controls
91 lines (79 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Test
on: [push, pull_request]
jobs:
luacheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: leafo/gh-actions-lua@v13
with:
luaVersion: "luajit-openresty"
- uses: leafo/gh-actions-luarocks@v6
with:
luarocksVersion: "3.12.2"
- run: luarocks install luacheck
- run: luacheck lib
run_tests:
strategy:
matrix:
openresty_version:
- 1.21.4.4
- 1.25.3.2
- 1.27.1.2
- 1.29.2.5
- 1.31.1.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@v6
- name: Install deps
run: |
apk add --no-cache curl perl bash wget git perl-dev libarchive-tools nodejs build-base
ln -s /usr/bin/bsdtar /usr/bin/tar
- name: Install CPAN
run: curl -s -L https://cpanmin.us | perl - App::cpanminus > /bin/cpanm && chmod +x /bin/cpanm
- name: Cache
uses: actions/cache@v5
with:
path: |
~/.cpan
~/.cache
key: ${{ runner.os }}-${{ matrix.openresty_version }}-cache
- name: Install Test::Nginx
run: cpanm -q -n Test::Nginx
- name: Install latest LuaRocks
run: |
case ${{ matrix.openresty_version }} in
1.19.* | 1.21.*)
# Remove old luarocks if exists
rm -rf /usr/local/openresty/luajit/bin/luarocks* || true
# Download and install latest LuaRocks
cd /tmp
wget https://luarocks.org/releases/luarocks-3.12.2.tar.gz
tar zxpf luarocks-3.12.2.tar.gz
cd luarocks-3.12.2
./configure --prefix=/usr/local/openresty/luajit \
--with-lua=/usr/local/openresty/luajit \
--lua-suffix=jit \
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
make build && make install
;;
*)
echo "No Luarocks update required"
;;
esac
- name: Install Luacov
run: |
# Clear any existing cache
rm -rf ~/.cache/luarocks || true
/usr/local/openresty/luajit/bin/luarocks install luacov
/usr/local/openresty/luajit/bin/luarocks install lua-resty-openssl
- name: Run tests
run: make coverage
- name: Coverage
run: |
luacov
tail -n 8 luacov.report.out