-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(healthcheck) support setting the events module (#105)
* feat(healthcheck) support setting the events module * fix(healthcheck) defaults to lua-resty-worker-events * tests(workflows) fixed manual deps install * fix(healthcheck) check empty opts * chore(workflows) use last luarocks * test(workflows) use pre-built deps, test with or 1.13-1.21 * chore(workflows) install lua-resty-events in ci * tests(workflows) debug * fixed tests and resty-events usage * init resty-events in init_worker * fix(tests) init events module (#107) * add init_worker in 03-get_target_status.t * fix 03-get_target_status.t * fix 03-get_target_status_with_sleeps.t * fix 04-report_success.t * fix 05/06 * fix 07/08 * fix 09 * change 10 * fix 11 * fix 12 * change 13 * fix 15 * partial fix 16 * change 17 * fix 18 * change 13 * fix 16 * style 05 * fix 01/02 * use string.buffer in OpenResty 1.21.4.1 (#109) * use string.buffer in OpenResty 1.21.4.1 * remove cjson require * fix(healthcheck) use the events module set in defaults * tests(with_resty-events) disabled tests that need more work * fix(healthcheck) avoid breaking when opts are nil * tests(with_resty-events) removed unnecessary test * tests(with_resty-events) increased sleeps Co-authored-by: Chrono <[email protected]>
- Loading branch information
Showing
51 changed files
with
5,071 additions
and
586 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
name: Build and test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: CI using lua-resty-events | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
openresty-version: [1.15.8.3, 1.17.8.2, 1.19.9.1, 1.21.4.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.1.0 | ||
LUAROCKS_VER: 3.9.0 | ||
OPENSSL_VER: 1.1.1o | ||
PCRE_VER: 8.45 | ||
run: | | ||
echo "INSTALL_ROOT=$HOME/install-root" >> $GITHUB_ENV | ||
echo "DOWNLOAD_ROOT=$HOME/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: ${{ env.GITHUB_WORKSPACE }}/ | ||
key: ${{ runner.os }}-${{ hashFiles('**/.github/workflows/build_and_test_with_resty_events.yml') }}-${{ matrix.openresty-version }} | ||
|
||
- name: Add to Path | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: echo "$INSTALL_ROOT/bin:$INSTALL_ROOT/nginx/sbin:$INSTALL_ROOT/luajit/bin:/usr/bin" >> $GITHUB_PATH | ||
|
||
- name: Build and install OpenSSL | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
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 | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
with: | ||
repository: Kong/lua-resty-events | ||
ref: refs/tags/0.1.0 | ||
path: lua-resty-events | ||
|
||
- name: Build and install OpenResty | ||
if: steps.cache-deps.outputs.cache-hit != true | ||
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 | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
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 | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: | | ||
luarocks install luacheck | ||
- name: Install Test::NGINX | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
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 | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
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_RANDOMIZE=1 prove -I. -r t/with_resty-events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Build and test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: CI using lua-resty-worker-events | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
openresty-version: [1.15.8.3, 1.17.8.2, 1.19.9.1, 1.21.4.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 }} | ||
run: | | ||
echo "/usr/local/openresty/nginx/sbin" >> $GITHUB_PATH | ||
- name: Checkout lua-resty-healthcheck | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install OpenResty ${{ matrix.openresty-version }} | ||
env: | ||
OPENRESTY_VER: ${{ matrix.openresty-version }} | ||
run: | | ||
sudo apt-get -y install --no-install-recommends wget gnupg ca-certificates | ||
wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add - | ||
echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list | ||
sudo apt-get update | ||
sudo apt-get -y install openresty=$OPENRESTY_VER-1~focal1 | ||
- name: Install LuaRocks | ||
run: sudo apt-get install -y luarocks | ||
|
||
- name: Install manual dependencies | ||
run: | | ||
sudo luarocks install luacheck | ||
sudo luarocks install lua-resty-worker-events 1.0.0 | ||
- 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: Checkout lua-resty-healthcheck | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install lua-resty-healthcheck | ||
run: sudo luarocks make | ||
|
||
- name: Run tests | ||
run: | | ||
eval `luarocks path` | ||
eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib) | ||
TEST_NGINX_RANDOMIZE=1 prove -I. -r t/with_worker-events |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.