-
Notifications
You must be signed in to change notification settings - Fork 21
86 lines (73 loc) · 2.72 KB
/
tests.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
name: Tests
on:
pull_request: {}
push:
branches:
- main
# cancel previous runs if new commits are pushed to the PR, but run for each commit on master
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
strategy:
matrix:
openresty:
- '1.25.3.2'
- '1.25.3.1'
- '1.21.4.4'
- '1.21.4.3'
- '1.21.4.2'
- '1.21.4.1'
env:
JOBS: 1
OPENRESTY: ${{ matrix.openresty }}
CODE_PATH: ${{ github.workspace }}
BASE_PATH: /home/runner/work/cache
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GHA_KONG_BOT_READ_TOKEN }}
- name: Make sure Cargo can clone private repositories
run: |
git config --global url."https://${{ secrets.GHA_KONG_BOT_READ_TOKEN }}@github.com".insteadOf https://github.com
- name: Setup cache
uses: actions/cache@v2
id: cache-deps
with:
path: |
${{ env.BASE_PATH }}
key: ${{ runner.os }}-${{ hashFiles('Makefile') }}-${{ hashFiles('**/tests.yml') }}-openresty-${{ matrix.openresty }}
- name: Install packages
run: |
sudo apt update
sudo apt-get install -qq -y wget cpanminus net-tools libpcre3-dev build-essential valgrind
if [ ! -e perl ]; then sudo cpanm --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1); cp -r /usr/local/share/perl/ .; else sudo cp -r perl /usr/local/share; fi
- name: Download OpenResty
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
wget https://openresty.org/download/openresty-${OPENRESTY}.tar.gz
mkdir -p ${BASE_PATH}
tar xfz openresty-${OPENRESTY}.tar.gz -C ${BASE_PATH}
- name: Setup tools
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
cd ${BASE_PATH}/openresty-${OPENRESTY}
./configure --prefix=${BASE_PATH}/openresty --with-debug
sudo make -j$(nproc) && make install -j$(nproc)
- name: Run Test
run: |
export PATH=${BASE_PATH}/openresty/bin:$PATH
openresty -V
make test OPENRESTY_PREFIX=${BASE_PATH}/openresty
- name: Run Valgrind
run: |
export PATH=${BASE_PATH}/openresty/bin:$PATH
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=120 TEST_NGINX_SLEEP=1
export TEST_NGINX_USE_VALGRIND=1
openresty -V
make valgrind OPENRESTY_PREFIX=${BASE_PATH}/openresty