-
Notifications
You must be signed in to change notification settings - Fork 463
100 lines (97 loc) · 3.99 KB
/
ci.yml
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
92
93
94
95
96
97
98
99
100
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: 'build'
runs-on: ubuntu-latest
steps:
- name: 'checkout'
uses: actions/checkout@v3
with:
path: nginx-module-vts
- name: 'checkout nginx'
uses: actions/checkout@v3
with:
repository: nginx/nginx
path: nginx
- name: 'checkout luajit2'
uses: actions/checkout@v3
with:
repository: openresty/luajit2
path: luajit2
- name: 'checkout ngx_devel_kit'
uses: actions/checkout@v3
with:
repository: vision5/ngx_devel_kit
path: ngx_devel_kit
- name: 'checkout lua-nginx-module'
uses: actions/checkout@v3
with:
repository: openresty/lua-nginx-module
path: lua-nginx-module
- name: 'checkout lua-resty-core'
uses: actions/checkout@v3
with:
repository: openresty/lua-resty-core
path: lua-resty-core
- name: 'checkout lua-resty-lrucache'
uses: actions/checkout@v3
with:
repository: openresty/lua-resty-lrucache
path: lua-resty-lrucache
- name: 'build luajit2'
working-directory: luajit2
run: |
make
sudo make install
sudo mkdir /usr/local/share/lua/5.1/resty
- name: 'link resty lib'
working-directory: /usr/local/share/lua/5.1/resty
run: |
sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-core/lib/resty/core core
sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-core/lib/resty/core.lua core.lua
sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-lrucache/lib/resty/lrucache lrucache
sudo ln -s /home/runner/work/nginx-module-vts/nginx-module-vts/lua-resty-lrucache/lib/resty/lrucache.lua lrucache.lua
- name: 'prepare nginx_upstream_check'
uses: actions/checkout@v3
with:
repository: yaoweibin/nginx_upstream_check_module
path: nginx_upstream_check
- name: 'patch upstream_check'
working-directory: nginx
run: |
patch -p1 < /home/runner/work/nginx-module-vts/nginx-module-vts/nginx_upstream_check/check_1.20.1+.patch
- name: 'build nginx'
working-directory: nginx
run: |
./auto/configure --with-ld-opt="-Wl,-rpath,/usr/local/lib" --without-pcre2 --add-module=/home/runner/work/nginx-module-vts/nginx-module-vts/ngx_devel_kit --add-module=/home/runner/work/nginx-module-vts/nginx-module-vts/lua-nginx-module --add-module=/home/runner/work/nginx-module-vts/nginx-module-vts/nginx-module-vts --add-module=/home/runner/work/nginx-module-vts/nginx-module-vts/nginx_upstream_check
make
sudo make install
/usr/local/nginx/sbin/nginx -V
env:
LUAJIT_LIB: /usr/local/lib
LUAJIT_INC: /usr/local/include/luajit-2.1
- name: 'prepare cpanm'
run: |
sudo apt install -y cpanminus
sudo cpanm --notest Test::Nginx::Socket > build.log 2>&1 || (cat build.log && exit 1)
- name: 'prepare promtool'
run: |
sudo apt-get update && sudo apt-get install -y curl
curl -L $(curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4) -o prometheus-latest.tar.gz
tar xvf prometheus-latest.tar.gz
sudo mv prometheus-*/promtool /usr/local/bin
- name: 'test'
working-directory: nginx-module-vts
run: |
echo "/usr/local/nginx/sbin/" >> $GITHUB_PATH
sudo PATH=/usr/local/nginx/sbin:$PATH prove -r t
- name: 'test upstream check'
working-directory: nginx-module-vts
run: |
echo "/usr/local/nginx/sbin/" >> $GITHUB_PATH
sudo TEST_UPSTREAM_CHECK=1 TEST_NGINX_SLEEP=1 PATH=/usr/local/nginx/sbin:$PATH prove t/024.upstream_check.t