-
Notifications
You must be signed in to change notification settings - Fork 10
198 lines (193 loc) · 6.74 KB
/
job-valgrind-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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Valgrind
on:
workflow_call:
inputs:
os:
required: true
type: string
cc:
required: true
type: string
ngx:
required: true
type: string
openresty:
required: true
type: string
runtime:
required: true
type: string
wasmtime:
required: true
type: string
wasmer:
required: true
type: string
v8:
required: true
type: string
debug:
required: true
type: string
hup:
required: true
type: string
path:
required: false
type: string
coverage:
required: false
type: boolean
default: false
defaults:
run:
shell: bash
env:
CC: ${{ inputs.cc }}
NGX: ${{ inputs.ngx }}
NGX_IPC: 1
NGX_BUILD_OPENRESTY: ${{ inputs.openresty }}
NGX_BUILD_GCOV: ${{ inputs.coverage && 1 || 0 }}
NGX_BUILD_DEBUG: ${{ inputs.debug == 'debug' && 1 || 0 }}
NGX_BUILD_CC_OPT: '-O2'
NGX_BUILD_NOPOOL: 1
TEST_NGINX_USE_VALGRIND: 1
TEST_NGINX_USE_VALGRIND_ALL: 0
TEST_NGINX_USE_HUP: ${{ inputs.hup == 'hup' && 1 || 0 }}
TEST_NGINX_RANDOMIZE: ${{ github.run_attempt == '1' && 1 || 0 }}
TEST_NGINX_NO_CLEAN: 1
TEST_NGINX_TIMEOUT: 120
TEST_NGINX_EXTERNAL_TIMEOUT: 120s
TEST_NGINX_EXTERNAL_RESOLVER: 127.0.0.1:8053
jobs:
valgrind:
name: 'Valgrind tests'
runs-on: ${{ inputs.os }}
timeout-minutes: 150
steps:
- name: 'Setup deps - apt-get'
if: ${{ contains(inputs.os, 'ubuntu') }}
run: sudo apt-get update && sudo apt-get install -y valgrind ${CC} libstdc++-${CC#*-}-dev lcov
- uses: actions/checkout@v4
- name: 'Setup cache - rustup toolchain'
uses: actions/cache@v4
if: ${{ !env.ACT }}
with:
path: |
~/.rustup/settings.toml
~/.rustup/toolchains/*
~/.rustup/update-hashes/*
key: rust-toolchain-${{ inputs.os }}-${{ hashFiles('.github/**/*.yml', '.github/**/*.sh', 'rust-toolchain') }}
- name: 'Setup cache - work/ dir'
uses: actions/cache@v4
if: ${{ !env.ACT }}
with:
path: |
work/downloads
work/runtimes
work/openssl
key: work-${{ inputs.os }}-${{ inputs.cc }}-${{ inputs.ngx }}-${{ inputs.openresty }}-${{ inputs.runtime }}-${{ hashFiles('util/**/*.sh', 'util/**/*.pl', 'util/**/*.awk', '.github/**/*.yml', '.github/**/*.sh', '.github/**/*.js', 'rust-toolchain', 'Makefile') }}
- name: Setup Rust
if: ${{ !env.ACT }}
uses: dtolnay/rust-toolchain@1ff72ee08e3cb84d84adba594e0a297990fc1ed3 # stable
with:
target: wasm32-wasip1
- name: Setup Go
if: ${{ !env.ACT }}
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Setup TinyGo
if: ${{ !env.ACT }}
uses: acifani/setup-tinygo@b2ba42b249c7d3efdfe94166ec0f48b3191404f7 # v2
with:
tinygo-version: 0.31.1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.9.0
- name: Setup Wasm runtime
run: ./util/runtime.sh -R ${{ inputs.runtime }} -V ${{ inputs[inputs.runtime] }}
- name: Setup local httpbin server
#if: ${{ !env.ACT }}
uses: ./.github/actions/setup-httpbin-server
with:
os: ${{ matrix.os }}
ghcr_username: ${{ github.repository_owner }}
ghcr_password: ${{ secrets.TOKEN_GITHUB }}
- run: make setup
- run: make
- name: Run tests
run: |
IN_PATH="${{ inputs.path }}"
./util/test.sh ${IN_PATH:-t/0*} 2>&1 | tee valgrind.out
- run: |
awk -f ./util/parse-valgrind.awk valgrind.out > valgrind.log
if [[ -s valgrind.log ]]; then
cat valgrind.log >&2
exit 1
fi
- name: Run lcov
id: lcov
if: ${{ !env.ACT && inputs.coverage }}
run: |
case "$CC" in
clang*)
lcov --gcov-tool gcov --ignore-errors source --capture --directory work/buildroot --output-file lcov.info
lcov --ignore-errors unused --gcov-tool gcov --remove lcov.info "*/ngx_wasm_module/src/common/debug/*" --output-file lcov.info
lcov --gcov-tool gcov --extract lcov.info "*/ngx_wasm_module/src/*" --output-file lcov.info
;;
*)
lcov --gcov-tool gcov-${CC#*-} --ignore-errors source --capture --directory work/buildroot --output-file lcov.info
lcov --ignore-errors unused --gcov-tool gcov-${CC#*-} --remove lcov.info "*/ngx_wasm_module/src/common/debug/*" --output-file lcov.info
lcov --gcov-tool gcov-${CC#*-} --extract lcov.info "*/ngx_wasm_module/src/*" --output-file lcov.info
;;
esac
name="valgrind"
if [ -n "${{ inputs.openresty }}" ]; then
name="$name-openresty_${{ inputs.openresty }}"
else
name="$name-ngx_${{ inputs.ngx }}"
fi
name="$name-${{ inputs.runtime }}"
name="$name-${{ inputs.ipc }}"
name="$name-${{ inputs.ssl }}"
name="$name-${{ inputs.debug }}"
name="$name-${{ inputs.hup }}"
if [ "${{ inputs.module_type }}" = dynamic ]; then
name="$name-dynamic"
else
name="$name-static"
fi
if [ -n "${{ inputs.wasm_target }}" ]; then
name="$name-${{ inputs.wasm_target }}"
fi
echo "name=$name" >> $GITHUB_OUTPUT
- name: Coveralls Upload
if: ${{ !env.ACT && inputs.coverage }}
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{ steps.lcov.outputs.name }}
path-to-lcov: './lcov.info'
parallel: true
- name: Codecov Upload
if: ${{ !env.ACT && inputs.coverage }}
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: './lcov.info'
flags: ${{ steps.lcov.outputs.name }}
- run: rm -f t/servroot/html/nginx.sock
if: ${{ failure() && !env.ACT }}
- uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
with:
name: ${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}-${{ inputs.ngx != '' && format('nginx-{0}', inputs.ngx) || format('openresty-{0}', inputs.openresty) }}-${{ inputs.runtime }}-${{ inputs.hup }}
path: |
work/buildroot/
t/servroot*
valgrind.out
- name: Cleanup
if: ${{ always() }}
uses: ./.github/actions/cleanup