-
Notifications
You must be signed in to change notification settings - Fork 51
142 lines (124 loc) · 4.96 KB
/
build_and_test_with_resty_events.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Build and test - with resty_events
concurrency:
# for PR's cancel the running task, if another commit is pushed
group: ${{ github.workflow }} ${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- main
- master
- release/**
jobs:
build:
name: CI using lua-resty-events
runs-on: ubuntu-20.04
strategy:
matrix:
openresty-version: [1.19.9.1, 1.21.4.3, 1.25.3.1]
steps:
- name: Update and install OS dependencies
run: |
sudo apt-get update && sudo apt-get install -y libssl-dev ssl-cert
sudo systemctl disable nginx
sudo systemctl stop nginx
- name: Set environment variables
env:
OPENRESTY_VER: ${{ matrix.openresty-version }}
RESTY_EVENTS_VER: 0.2.1
LUAROCKS_VER: 3.9.0
OPENSSL_VER: 1.1.1q
PCRE_VER: 8.45
run: |
echo "INSTALL_ROOT=/home/runner/work/cache/install-root" >> $GITHUB_ENV
echo "DOWNLOAD_ROOT=/home/runner/work/cache/download-root" >> $GITHUB_ENV
echo "OPENRESTY=$OPENRESTY_VER" >> $GITHUB_ENV
echo "LUAROCKS=$LUAROCKS_VER" >> $GITHUB_ENV
echo "OPENSSL=$OPENSSL_VER" >> $GITHUB_ENV
echo "PCRE=$PCRE_VER" >> $GITHUB_ENV
echo "RESTY_EVENTS=$RESTY_EVENTS_VER" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOME/install-root/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Checkout lua-resty-healthcheck
uses: actions/checkout@v3
- name: Lookup build cache
uses: actions/cache@v3
id: cache-deps
with:
path: |
/home/runner/work/cache/install-root
/home/runner/work/cache/download-root
key: ${{ runner.os }}-${{ hashFiles('**/.github/workflows/build_and_test_with_resty_events.yml') }}-${{ matrix.openresty-version }}
- name: Add to Path
run: echo "$INSTALL_ROOT/bin:$INSTALL_ROOT/nginx/sbin:$INSTALL_ROOT/luajit/bin:/usr/bin" >> $GITHUB_PATH
- name: Build and install OpenSSL
run: |
curl -sSLO https://www.openssl.org/source/openssl-$OPENSSL.tar.gz
tar -xzf openssl-$OPENSSL.tar.gz
cd openssl-$OPENSSL
./config -g shared -DPURIFY no-threads --prefix=$INSTALL_ROOT --openssldir=$INSTALL_ROOT no-unit-test
make
make install_sw
- name: Checkout lua-resty-events
uses: actions/checkout@v3
with:
repository: Kong/lua-resty-events
ref: refs/tags/0.2.1
path: lua-resty-events
- name: Build and install OpenResty
run: |
curl -sSLO https://openresty.org/download/openresty-$OPENRESTY.tar.gz
tar -xzf openresty-$OPENRESTY.tar.gz
cd openresty-$OPENRESTY
./configure \
--prefix=$INSTALL_ROOT \
--with-cc-opt='-I$INSTALL_ROOT/include' \
--with-ld-opt='-L$INSTALL_ROOT/lib -Wl,-rpath,$INSTALL_ROOT/lib' \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_v2_module \
--without-http_encrypted_session_module \
--with-stream_realip_module \
--with-stream_ssl_preread_module \
--add-module=../lua-resty-events \
--with-pcre
make
make install
make install LUA_LIBDIR=$INSTALL_ROOT/lualib
- name: Install LuaRocks
run: |
curl -sSLO https://luarocks.org/releases/luarocks-$LUAROCKS.tar.gz
tar -xzf luarocks-$LUAROCKS.tar.gz
cd luarocks-$LUAROCKS
./configure \
--prefix=$INSTALL_ROOT \
--lua-suffix=jit \
--with-lua=$INSTALL_ROOT/luajit \
--with-lua-include=$INSTALL_ROOT/luajit/include/luajit-2.1
make build
make install
- name: Install manual dependencies
run: |
luarocks install luacheck
- name: Install Test::NGINX
run: |
sudo apt-get install cpanminus
cpanm --notest --local-lib=$HOME/perl5 local::lib && eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib)
cpanm --notest Test::Nginx
- name: Install lua-resty-events
run: |
cd lua-resty-events
OPENRESTY_PREFIX=$INSTALL_ROOT PREFIX=$INSTALL_ROOT LUA_LIB_DIR=$INSTALL_ROOT/lualib make install
- name: Install lua-resty-healthcheck
run: luarocks make
- name: Run tests
env:
PATH: ${{ env.INSTALL_ROOT }}/bin:${{ env.INSTALL_ROOT }}/nginx/sbin:${{ env.INSTALL_ROOT }}/luajit/bin:/usr/bin
TEST_NGINX_BINARY: ${{ env.INSTALL_ROOT }}/nginx/sbin/nginx
run: |
eval `luarocks path`
eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib)
TEST_NGINX_TIMEOUT=4 TEST_NGINX_RANDOMIZE=1 prove -I. -r t/with_resty-events