Skip to content

Commit 171ef0b

Browse files
authored
Add performance tests and cleanup
1 parent 41f4907 commit 171ef0b

1 file changed

Lines changed: 56 additions & 13 deletions

File tree

.github/workflows/verify-build.yml

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,30 @@ jobs:
200200
cc-compiler: clang++-9
201201
debug: nodebug
202202
coverage: nocoverage
203+
- test-group: performance
204+
os: ubuntu-latest
205+
build-type: select
206+
compiler-family: gcc
207+
c-compiler: gcc-7
208+
cc-compiler: g++-7
209+
debug: nodebug
210+
coverage: nocoverage
211+
- test-group: performance
212+
os: ubuntu-latest
213+
build-type: nodelay
214+
compiler-family: gcc
215+
c-compiler: gcc-7
216+
cc-compiler: g++-7
217+
debug: nodebug
218+
coverage: nocoverage
219+
- test-group: performance
220+
os: ubuntu-latest
221+
build-type: threads
222+
compiler-family: gcc
223+
c-compiler: gcc-7
224+
cc-compiler: g++-7
225+
debug: nodebug
226+
coverage: nocoverage
203227
steps:
204228
- name: Checkout repository
205229
uses: actions/checkout@v2
@@ -218,7 +242,11 @@ jobs:
218242
sudo add-apt-repository ppa:ubuntu-toolchain-r/test ;
219243
sudo apt-get update ;
220244
if: ${{ matrix.test-group == 'extra' && matrix.os == 'ubuntu-latest' }}
221-
245+
246+
- name: Install apache benchmark if needed
247+
run: sudo apt-get install apache2-utils ;
248+
if: ${{ matrix.test-group == 'performance' && matrix.os == 'ubuntu-latest' }}
249+
222250
- name: Install optional clang if needed
223251
run: sudo apt-get install ${{ matrix.c-compiler }}
224252
if: ${{ matrix.compiler-family == 'clang' && matrix.os == 'ubuntu-latest' }}
@@ -229,7 +257,7 @@ jobs:
229257

230258
- name: Install valgrind if needed
231259
run: sudo apt-get install valgrind valgrind-dbg
232-
if: ${{ matrix.build-type == 'valgrind' }}
260+
if: ${{ matrix.build-type == 'valgrind' && matrix.os == 'ubuntu-latest' }}
233261

234262
- name: Install IWYU dependencies if needed
235263
run: |
@@ -238,10 +266,18 @@ jobs:
238266
# Use same CMAKE used by iwyu in their setup for travis
239267
wget -O cmake.sh https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh ;
240268
sudo sh cmake.sh --skip-license --exclude-subdir --prefix=/usr/local ;
241-
if: ${{ matrix.build-type == 'iwyu' }}
269+
if: ${{ matrix.build-type == 'iwyu' && matrix.os == 'ubuntu-latest' }}
270+
271+
- name: IWYU from cache (for testing)
272+
id: cache-IWYU
273+
uses: actions/cache@v2
274+
with:
275+
path: include-what-you-use
276+
key: ${{ matrix.os }}-include-what-you-use-pre-built
277+
if: ${{ matrix.build-type == 'iwyu' && matrix.os == 'ubuntu-latest' }}
242278

243279
# Installing iwyu manually because clang and iwyu paths won't match on Ubuntu otherwise.
244-
- name: Install IWYU if requested
280+
- name: Build IWYU if requested
245281
run: |
246282
CLANG_ROOT_PATH=`llvm-config-9 --prefix` ;
247283
CLANG_BIN_PATH=`llvm-config-9 --bindir` ;
@@ -253,14 +289,21 @@ jobs:
253289
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=$CLANG_ROOT_PATH -DCMAKE_C_COMPILER=$CLANG_BIN_PATH/clang -DCMAKE_CXX_COMPILER=$CLANG_BIN_PATH/clang++ ../ ;
254290
make ;
255291
sudo make install ;
256-
if: ${{ matrix.build-type == 'iwyu' }}
292+
if: ${{ matrix.build-type == 'iwyu' && matrix.os == 'ubuntu-latest' && steps.cache-IWYU.outputs.cache-hit != 'true' }}
293+
294+
- name: Install IWYU if requested
295+
run: |
296+
cd include-what-you-use/build_iwyu ;
297+
sudo make install ;
298+
if: ${{ matrix.build-type == 'iwyu' && matrix.os == 'ubuntu-latest' }}
257299

258300
- name: CURL from cache (for testing)
259301
id: cache-CURL
260302
uses: actions/cache@v2
261303
with:
262304
path: curl-7.75.0
263305
key: ${{ matrix.os }}-CURL-pre-built
306+
if: ${{ matrix.os == 'macos-latest' }}
264307

265308
- name: Build CURL (for testing)
266309
run: |
@@ -269,7 +312,7 @@ jobs:
269312
cd curl-7.75.0 ;
270313
if [ "$matrix.os" = "ubuntu-latest" ]; then ./configure ; else ./configure --with-darwinssl ; fi
271314
make ;
272-
if: steps.cache-CURL.outputs.cache-hit != 'true'
315+
if: ${{ matrix.os == 'macos-latest' && steps.cache-CURL.outputs.cache-hit != 'true' }}
273316

274317
- name: Install CURL (for testing on mac only)
275318
run: cd curl-7.75.0 ; sudo make install ;
@@ -387,31 +430,31 @@ jobs:
387430

388431
- name: Run performance tests (select)
389432
run: |
390-
if [ "$PERFORMANCE" = "select" ]; then
433+
if [ "$BUILD_TYPE" = "select" ]; then
391434
cd build
392435
cd examples
393436
./benchmark_select 8080 $(nproc) &
394-
sleep 5 && ab -n 10000000 -c 100 localhost:8080/plaintext
437+
sleep 5 && ab -n 1000000 -c 100 localhost:8080/plaintext
395438
fi
396439
397440
- name: Run performance tests (nodelay)
398441
run: |
399-
if [ "$PERFORMANCE" = "nodelay" ]; then
442+
if [ "$BUILD_TYPE" = "nodelay" ]; then
400443
cd build
401444
cd examples
402445
./benchmark_nodelay 8080 $(nproc) &
403-
sleep 5 && ab -n 10000000 -c 100 localhost:8080/plaintext
446+
sleep 5 && ab -n 1000000 -c 100 localhost:8080/plaintext
404447
fi
405448
406449
- name: Run performance tests (threads)
407450
run: |
408-
if [ "$PERFORMANCE" = "threads" ]; then
451+
if [ "$BUILD_TYPE" = "threads" ]; then
409452
cd build
410453
cd examples
411454
./benchmark_threads 8080 &
412-
sleep 5 && ab -n 10000000 -c 100 localhost:8080/plaintext
455+
sleep 5 && ab -n 1000000 -c 100 localhost:8080/plaintext
413456
fi
414457
415458
- name: Push code coverage data
416459
run: if [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then cd build ; bash <(curl -s https://codecov.io/bash); fi
417-
if: ${{ matrix.os == 'ubuntu-latest' && matrix.c-compiler == 'gcc' }}
460+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.c-compiler == 'gcc' && success() }}

0 commit comments

Comments
 (0)