Skip to content

Commit 4d19e8d

Browse files
ADD-SPfffonion
authored andcommitted
chore(build): build Kong binary for testing
1 parent baba594 commit 4d19e8d

File tree

4 files changed

+34
-60
lines changed

4 files changed

+34
-60
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Lint
22

3-
on: [push, pull_request]
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
7+
cancel-in-progress: true
48

59
jobs:
610
tests:

.github/workflows/tests.yml

Lines changed: 26 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,34 @@
11
name: Tests
22

3-
on: [push, pull_request]
3+
on: [pull_request]
4+
5+
env:
6+
KONG_VERSION: master
7+
BUILD_ROOT: ${{ github.workspace }}/kong/bazel-bin/build
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
412

513
jobs:
6-
tests:
7-
name: Tests
8-
runs-on: ubuntu-20.04
9-
10-
strategy:
11-
matrix:
12-
include:
13-
# TODO: arm64
14-
- openresty: "1.19.3.2"
15-
luarocks: "3.7.0"
16-
openssl: "1.1.1k"
17-
- openresty: "1.19.9.1"
18-
luarocks: "3.8.0"
19-
openssl: "1.1.1m"
20-
- openresty: "1.21.4.1"
21-
luarocks: "3.9.1"
22-
openssl: "1.1.1q"
23-
24-
env:
25-
JOBS: 1 # must be 1 as socket tests interfere with each other
26-
27-
INSTALL_ROOT: /home/runner/work/install-root
28-
DOWNLOAD_ROOT: /home/runner/work/download-root
29-
30-
OPENSSL_INSTALL: /home/runner/work/install-root/openssl
31-
OPENSSL_DIR: /home/runner/work/install-root/openssl
32-
OPENRESTY_INSTALL: /home/runner/work/install-root/openresty
33-
LUAROCKS_INSTALL: /home/runner/work/install-root/luarocks
34-
35-
BUILD_TOOLS_DOWNLOAD: /home/runner/work/download-root/kong-build-tools
36-
BUILD_TOOLS_BRANCH: master
37-
38-
OPENRESTY: ${{ matrix.openresty }}
39-
LUAROCKS: ${{ matrix.luarocks }}
40-
OPENSSL: ${{ matrix.openssl }}
14+
build:
15+
name: Build dependencies
16+
runs-on: ubuntu-22.04
4117

4218
steps:
4319
- name: Checkout source code
44-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
21+
22+
- name: Checkout Kong source code
23+
uses: actions/checkout@v3
4524
with:
46-
submodules: 'true'
25+
repository: kong/kong
26+
ref: ${{ env.KONG_VERSION }}
27+
path: kong
4728

48-
- name: Setup cache
49-
uses: actions/cache@v2
29+
- name: Lookup build cache
5030
id: cache-deps
31+
uses: actions/cache@v3
5132
with:
5233
path: |
5334
${{ env.BUILD_ROOT }}
@@ -96,7 +77,7 @@ jobs:
9677
- name: Install packages
9778
run: |
9879
sudo apt update
99-
sudo apt-get install -qq -y cpanminus net-tools libpcre3-dev build-essential valgrind
80+
sudo apt install libyaml-dev valgrind libprotobuf-dev cpanminus net-tools libpcre3-dev build-essential
10081
10182
- name: Install Test::Nginx
10283
run: |
@@ -109,21 +90,18 @@ jobs:
10990
11091
- name: Run Test
11192
run: |
112-
export PATH=$OPENSSL_INSTALL/bin:$OPENRESTY_INSTALL/nginx/sbin:$OPENRESTY_INSTALL/bin:$LUAROCKS_INSTALL/bin:$PATH
113-
export LD_LIBRARY_PATH=$OPENSSL_INSTALL/lib:$LD_LIBRARY_PATH # for openssl's CLI invoked in the test suite
93+
source ${{ env.BUILD_ROOT }}/kong-dev-venv.sh
11494
11595
nginx -V
11696
resty -V
11797
luarocks --version
11898
openssl version
11999
120-
eval `luarocks path`
121-
prove -j$JOBS -r t
100+
prove -r t
122101
123102
- name: Run Test with Valgrind
124103
run: |
125-
export PATH=$OPENSSL_INSTALL/bin:$OPENRESTY_INSTALL/nginx/sbin:$OPENRESTY_INSTALL/bin:$LUAROCKS_INSTALL/bin:$PATH
126-
export LD_LIBRARY_PATH=$OPENSSL_INSTALL/lib:$LD_LIBRARY_PATH # for openssl's CLI invoked in the test suite
104+
source ${{ env.BUILD_ROOT }}/kong-dev-venv.sh
127105
128106
export TEST_NGINX_VALGRIND='--num-callers=100 -q --tool=memcheck --leak-check=full --show-possibly-lost=no --gen-suppressions=all --suppressions=valgrind.suppress --track-origins=yes' TEST_NGINX_TIMEOUT=60 TEST_NGINX_SLEEP=1
129107
export TEST_NGINX_USE_VALGRIND=1
@@ -133,7 +111,5 @@ jobs:
133111
luarocks --version
134112
openssl version
135113
136-
eval `luarocks path`
137114
# fail if definite leak found
138-
prove -j$JOBS -r t 2>&1 | tee /dev/stderr | grep -q "match-leak-kinds: definite" && exit 1 || exit 0
139-
115+
prove -r t 2>&1 | tee /dev/stderr | grep -q "match-leak-kinds: definite" && exit 1 || exit 0

t/005-indexed-var-openresty-suites.t

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,12 @@ variable not changeable
346346
}
347347
}
348348
--- config
349-
location =/balancer {
350-
set $port '';
351-
set_by_lua_block $port {
352-
local args, _ = ngx.req.get_uri_args()
353-
local port = args['port']
354-
return port
355-
}
349+
location ~ /balancer/(?<target_port>\d+) {
350+
set $port $target_port;
356351
proxy_pass http://balancer;
357352
}
358353
--- pipelined_requests eval
359-
["GET /balancer?port=8091", "GET /balancer?port=8092"]
354+
["GET /balancer/8091", "GET /balancer/8092"]
360355
--- response_body eval
361356
["this is backend peer 8091", "this is backend peer 8092"]
362357

t/008-log.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ ok
7474
log.set_log_level(ngx.DEBUG, 2)
7575
assert(log.get_log_level(ngx.WARN) == ngx.DEBUG)
7676
77-
ngx.update_time()
7877
ngx.sleep(3)
7978
assert(log.get_log_level(ngx.WARN) == ngx.WARN)
8079

0 commit comments

Comments
 (0)