-
Notifications
You must be signed in to change notification settings - Fork 192
754 lines (700 loc) · 26.7 KB
/
verify-build.yml
File metadata and controls
754 lines (700 loc) · 26.7 KB
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
name: "Verify Build"
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 0 * * 0'
jobs:
verify:
name: Verify
runs-on: ${{ matrix.os }}
env:
DEBUG: ${{ matrix.debug }}
COVERAGE: ${{ matrix.coverage }}
LINKING: ${{ matrix.linking }}
BUILD_TYPE: ${{ matrix.build-type }}
CC: ${{ matrix.c-compiler }}
CXX: ${{ matrix.cc-compiler }}
defaults:
run:
shell: ${{ matrix.shell }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os-type: [ubuntu, mac]
test-group: [basic]
compiler-family: [none]
c-compiler: [gcc, clang]
cc-compiler: [g++, clang++]
debug: [debug, nodebug]
coverage: [coverage, nocoverage]
linking: [dynamic, static]
build-type: [classic]
shell: [bash]
exclude:
- os: ubuntu-latest
os-type: mac
- os: macos-latest
os-type: ubuntu
- c-compiler: gcc
cc-compiler: clang++
- c-compiler: clang
cc-compiler: g++
- c-compiler: clang
debug: debug
- debug: debug
coverage: nocoverage
- debug: nodebug
coverage: coverage
- linking: static
debug: debug
- linking: static
coverage: coverage
include:
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: asan
compiler-family: clang
c-compiler: clang-18
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
# This test gives false positives on newer versions of clang
# and ubuntu-18.04 is not supported anymore on github
#- test-group: extra
# os: ubuntu-18.04
# os-type: ubuntu
# build-type: msan
# compiler-family: clang
# c-compiler: clang-6.0
# cc-compiler: clang++-6.0
# debug: debug
# coverage: nocoverage
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: lsan
compiler-family: clang
c-compiler: clang-18
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: tsan
compiler-family: clang
c-compiler: clang-18
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: ubsan
compiler-family: clang
c-compiler: clang-18
cc-compiler: clang++-18
debug: debug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: gcc
c-compiler: gcc-9
cc-compiler: g++-9
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: gcc
c-compiler: gcc-10
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: gcc
c-compiler: gcc-11
cc-compiler: g++-11
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: gcc
c-compiler: gcc-12
cc-compiler: g++-12
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: gcc
c-compiler: gcc-13
cc-compiler: g++-13
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: gcc
c-compiler: gcc-14
cc-compiler: g++-14
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-22.04
os-type: ubuntu
build-type: none
compiler-family: clang
c-compiler: clang-11
cc-compiler: clang++-11
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-22.04
os-type: ubuntu
build-type: none
compiler-family: clang
c-compiler: clang-12
cc-compiler: clang++-12
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-22.04
os-type: ubuntu
build-type: none
compiler-family: clang
c-compiler: clang-13
cc-compiler: clang++-13
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: clang
c-compiler: clang-14
cc-compiler: clang++-14
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: clang
c-compiler: clang-15
cc-compiler: clang++-15
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: clang
c-compiler: clang-16
cc-compiler: clang++-16
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: none
compiler-family: clang
c-compiler: clang-17
cc-compiler: clang++-17
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: valgrind
compiler-family: gcc
c-compiler: gcc-14
cc-compiler: g++-14
debug: nodebug
coverage: nocoverage
shell: bash
# Test build without digest auth support (issue #232)
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: no-dauth
compiler-family: gcc
c-compiler: gcc
cc-compiler: g++
debug: nodebug
coverage: nocoverage
linking: dynamic
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: iwyu
compiler-family: clang
c-compiler: clang-18
cc-compiler: clang++-18
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: performance
os: ubuntu-latest
os-type: ubuntu
build-type: select
compiler-family: gcc
c-compiler: gcc-10
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: performance
os: ubuntu-latest
os-type: ubuntu
build-type: nodelay
compiler-family: gcc
c-compiler: gcc-10
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: performance
os: ubuntu-latest
os-type: ubuntu
build-type: threads
compiler-family: gcc
c-compiler: gcc-10
cc-compiler: g++-10
debug: nodebug
coverage: nocoverage
shell: bash
- test-group: extra
os: ubuntu-latest
os-type: ubuntu
build-type: lint
compiler-family: gcc
c-compiler: gcc-10
cc-compiler: g++-10
debug: debug
coverage: nocoverage
shell: bash
- test-group: basic
os: windows-latest
os-type: windows
msys-env: MINGW64
shell: 'msys2 {0}'
build-type: classic
compiler-family: none
c-compiler: gcc
cc-compiler: g++
debug: nodebug
coverage: nocoverage
linking: dynamic
- test-group: basic
os: windows-latest
os-type: windows
msys-env: MSYS
shell: 'msys2 {0}'
build-type: classic
compiler-family: none
c-compiler: gcc
cc-compiler: g++
debug: nodebug
coverage: nocoverage
linking: dynamic
# ARM 32-bit cross-compilation (ARMv7 hard-float)
- test-group: cross-compile
os: ubuntu-latest
os-type: ubuntu
build-type: arm32
compiler-family: arm-cross
c-compiler: arm-linux-gnueabihf-gcc
cc-compiler: arm-linux-gnueabihf-g++
debug: nodebug
coverage: nocoverage
linking: dynamic
shell: bash
# ARM 64-bit cross-compilation (AArch64)
- test-group: cross-compile
os: ubuntu-latest
os-type: ubuntu
build-type: arm64
compiler-family: arm-cross
c-compiler: aarch64-linux-gnu-gcc
cc-compiler: aarch64-linux-gnu-g++
debug: nodebug
coverage: nocoverage
linking: dynamic
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
shell: bash
if: ${{ github.event_name == 'pull_request' }}
- name: Setup MSYS2
if: ${{ matrix.os-type == 'windows' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msys-env }}
update: true
install: >-
autotools
base-devel
- name: Install MinGW64 packages
if: ${{ matrix.os-type == 'windows' && matrix.msys-env == 'MINGW64' }}
run: |
pacman --noconfirm -S --needed mingw-w64-x86_64-{toolchain,libtool,make,pkg-config,libsystre,doxygen,gnutls,graphviz,curl}
- name: Install MSYS packages
if: ${{ matrix.os-type == 'windows' && matrix.msys-env == 'MSYS' }}
run: |
pacman --noconfirm -S --needed msys2-devel gcc make libcurl-devel libgnutls-devel
- name: Install Ubuntu test sources
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test ;
sudo apt-get update ;
if: ${{ matrix.os-type == 'ubuntu' }}
- name: Install apache benchmark if needed
run: sudo apt-get install apache2-utils ;
if: ${{ matrix.test-group == 'performance' && matrix.os-type == 'ubuntu' }}
- name: Install optional clang if needed
run: sudo apt-get install ${{ matrix.c-compiler }}
if: ${{ matrix.compiler-family == 'clang' && matrix.os-type == 'ubuntu' }}
- name: Install optional gcc if needed
run: sudo apt-get install ${{ matrix.cc-compiler }}
if: ${{ matrix.compiler-family == 'gcc' && matrix.os-type == 'ubuntu' }}
- name: Install ARM cross-compilation toolchain
run: |
sudo apt-get update
if [ "${{ matrix.build-type }}" = "arm32" ]; then
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
elif [ "${{ matrix.build-type }}" = "arm64" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
fi
if: ${{ matrix.compiler-family == 'arm-cross' }}
- name: Install valgrind if needed
run: sudo apt-get install valgrind
if: ${{ matrix.build-type == 'valgrind' && matrix.os-type == 'ubuntu' }}
- name: Install cpplint if needed
run: sudo pip3 install cpplint ;
if: ${{ matrix.build-type == 'lint' && matrix.os-type == 'ubuntu' }}
- name: Install IWYU dependencies if needed
run: |
sudo apt-get install llvm-18-dev libclang-18-dev clang-18 ;
if: ${{ matrix.build-type == 'iwyu' && matrix.os-type == 'ubuntu' }}
- name: IWYU from cache (for testing)
id: cache-IWYU
uses: actions/cache@v4
with:
path: include-what-you-use
key: ${{ matrix.os }}-${{ matrix.c-compiler }}-include-what-you-use-pre-built
if: ${{ matrix.build-type == 'iwyu' && matrix.os-type == 'ubuntu' }}
# Installing iwyu manually because clang and iwyu paths won't match on Ubuntu otherwise.
- name: Build IWYU if requested
run: |
CLANG_ROOT_PATH=`llvm-config-18 --prefix` ;
CLANG_BIN_PATH=`llvm-config-18 --bindir` ;
git clone https://github.com/include-what-you-use/include-what-you-use.git ;
cd include-what-you-use ;
git checkout clang_18 ;
mkdir build_iwyu ;
cd build_iwyu ;
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=$CLANG_ROOT_PATH -DCMAKE_C_COMPILER=$CLANG_BIN_PATH/clang -DCMAKE_CXX_COMPILER=$CLANG_BIN_PATH/clang++ ../ ;
make ;
sudo make install ;
if: ${{ matrix.build-type == 'iwyu' && matrix.os-type == 'ubuntu' && steps.cache-IWYU.outputs.cache-hit != 'true' }}
- name: Install IWYU if requested
run: |
cd include-what-you-use/build_iwyu ;
sudo make install ;
if: ${{ matrix.build-type == 'iwyu' && matrix.os-type == 'ubuntu' }}
- name: CURL from cache (for testing)
id: cache-CURL
uses: actions/cache@v4
with:
path: curl-7.75.0
key: ${{ matrix.os }}-CURL-pre-built-v2
if: ${{ matrix.os == 'macos-latest' }}
- name: Build CURL (for testing)
run: |
curl https://libhttpserver.s3.amazonaws.com/travis_stuff/curl-7.75.0.tar.gz -o curl-7.75.0.tar.gz ;
tar -xzf curl-7.75.0.tar.gz ;
cd curl-7.75.0 ;
./configure --with-darwinssl --without-ssl ;
make ;
if: ${{ matrix.os == 'macos-latest' && steps.cache-CURL.outputs.cache-hit != 'true' }}
- name: Install CURL (for testing on mac only)
run: cd curl-7.75.0 ; sudo make install ;
if: ${{ matrix.os == 'macos-latest' }}
- name: Install CURL (for testing on linux)
run: sudo apt-get install libcurl4-openssl-dev
if: ${{ matrix.os-type == 'ubuntu' }}
- name: Install autotools on mac
run: brew install autoconf automake libtool
if: ${{ matrix.os == 'macos-latest' }}
- name: Setup dependencies (only on linux)
run: |
sudo apt-get install info install-info ;
sudo apt-get install cppcheck ;
if: ${{ matrix.os-type == 'ubuntu' }}
- name: Setup coverage dependencies (only on linux)
run: |
sudo pip install gcovr ;
if: ${{ matrix.os-type == 'ubuntu' && matrix.c-compiler == 'gcc' && matrix.debug == 'debug' && matrix.coverage == 'coverage' }}
- name: Setup gnutls dependency (only on linux)
run: |
sudo apt-get install libgnutls28-dev gnutls-bin ;
if: ${{ matrix.os-type == 'ubuntu' }}
- name: Fetch libmicrohttpd from cache
id: cache-libmicrohttpd
uses: actions/cache@v4
with:
path: libmicrohttpd-0.9.77
key: ${{ matrix.os }}-${{ matrix.c-compiler }}-libmicrohttpd-0.9.77-pre-built-v2
if: ${{ matrix.os-type != 'windows' && matrix.build-type != 'no-dauth' && matrix.compiler-family != 'arm-cross' }}
- name: Build libmicrohttpd dependency (if not cached)
run: |
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.77.tar.gz -o libmicrohttpd-0.9.77.tar.gz ;
tar -xzf libmicrohttpd-0.9.77.tar.gz ;
cd libmicrohttpd-0.9.77 ;
./configure --disable-examples ;
make ;
if: ${{ matrix.os-type != 'windows' && matrix.build-type != 'no-dauth' && matrix.compiler-family != 'arm-cross' && steps.cache-libmicrohttpd.outputs.cache-hit != 'true' }}
- name: Build libmicrohttpd without digest auth (no-dauth test)
run: |
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.77.tar.gz -o libmicrohttpd-0.9.77.tar.gz ;
tar -xzf libmicrohttpd-0.9.77.tar.gz ;
cd libmicrohttpd-0.9.77 ;
./configure --disable-examples --disable-dauth ;
make ;
if: ${{ matrix.build-type == 'no-dauth' }}
- name: Install libmicrohttpd
run: cd libmicrohttpd-0.9.77 ; sudo make install ;
if: ${{ matrix.os-type != 'windows' && matrix.compiler-family != 'arm-cross' }}
- name: Verify digest auth is disabled (no-dauth test)
run: |
# Verify that MHD_queue_auth_fail_response is NOT present in libmicrohttpd
if nm /usr/local/lib/libmicrohttpd.so 2>/dev/null | grep -q MHD_queue_auth_fail_response; then
echo "ERROR: libmicrohttpd was built WITH digest auth support" ;
exit 1 ;
fi
echo "Verified: libmicrohttpd built without digest auth support" ;
if: ${{ matrix.build-type == 'no-dauth' }}
- name: Build and install libmicrohttpd (Windows)
if: ${{ matrix.os-type == 'windows' }}
run: |
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.77.tar.gz -o libmicrohttpd-0.9.77.tar.gz
tar -xzf libmicrohttpd-0.9.77.tar.gz
cd libmicrohttpd-0.9.77
./configure --disable-examples --enable-poll=no
make
make install
- name: Fetch libmicrohttpd from cache (ARM cross-compile)
id: cache-libmicrohttpd-arm
uses: actions/cache@v4
with:
path: libmicrohttpd-0.9.77-${{ matrix.build-type }}
key: ${{ matrix.os }}-${{ matrix.build-type }}-libmicrohttpd-0.9.77-cross-compiled
if: ${{ matrix.compiler-family == 'arm-cross' }}
- name: Cross-compile libmicrohttpd for ARM
run: |
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.77.tar.gz -o libmicrohttpd-0.9.77.tar.gz
tar -xzf libmicrohttpd-0.9.77.tar.gz
mv libmicrohttpd-0.9.77 libmicrohttpd-0.9.77-${{ matrix.build-type }}
cd libmicrohttpd-0.9.77-${{ matrix.build-type }}
mkdir -p ${{ github.workspace }}/arm-sysroot
if [ "${{ matrix.build-type }}" = "arm32" ]; then
./configure --host=arm-linux-gnueabihf --prefix=${{ github.workspace }}/arm-sysroot --disable-examples --disable-doc
else
./configure --host=aarch64-linux-gnu --prefix=${{ github.workspace }}/arm-sysroot --disable-examples --disable-doc
fi
make
make install
if: ${{ matrix.compiler-family == 'arm-cross' && steps.cache-libmicrohttpd-arm.outputs.cache-hit != 'true' }}
- name: Install cross-compiled libmicrohttpd from cache
run: |
cd libmicrohttpd-0.9.77-${{ matrix.build-type }}
mkdir -p ${{ github.workspace }}/arm-sysroot
make install
if: ${{ matrix.compiler-family == 'arm-cross' && steps.cache-libmicrohttpd-arm.outputs.cache-hit == 'true' }}
- name: Refresh links to shared libs
run: sudo ldconfig ;
if: ${{ matrix.os-type == 'ubuntu' }}
- name: Run cpplint on code
run: cpplint --extensions=cpp,hpp --headers=hpp --recursive . ;
if: ${{ matrix.build-type == 'lint' && matrix.os-type == 'ubuntu' }}
- name: Run libhttpserver configure
run: |
# Set memory check flags. They need to stay in step as env variables don't propagate across steps.
if [ "$BUILD_TYPE" = "asan" ]; then export CFLAGS='-fsanitize=address'; export CXXLAGS='-fsanitize=address'; export LDFLAGS='-fsanitize=address'; fi
if [ "$BUILD_TYPE" = "msan" ]; then export CFLAGS='-fsanitize=memory'; export CXXLAGS='-fsanitize=memory'; export LDFLAGS='-fsanitize=memory'; fi
if [ "$BUILD_TYPE" = "lsan" ]; then export CFLAGS='-fsanitize=leak'; export CXXLAGS='-fsanitize=leak'; export LDFLAGS='-fsanitize=leak'; fi
if [ "$BUILD_TYPE" = "tsan" ]; then export CFLAGS='-fsanitize=thread'; export CXXLAGS='-fsanitize=thread'; export LDFLAGS='-fsanitize=thread'; fi
if [ "$BUILD_TYPE" = "ubsan" ]; then export export CFLAGS='-fsanitize=undefined'; export CXXLAGS='-fsanitize=undefined'; export LDFLAGS='-fsanitize=undefined'; fi
# Additional flags on mac. They need to stay in step as env variables don't propagate across steps.
if [ "${{ matrix.os }}" = "macos-latest" ]; then
export CFLAGS='-mtune=generic' ;
export IPV6_TESTS_ENABLED="true" ;
fi
./bootstrap ;
mkdir build ;
cd build ;
if [ "${{ matrix.compiler-family }}" = "arm-cross" ]; then
export CPPFLAGS="-I${{ github.workspace }}/arm-sysroot/include"
export LDFLAGS="-L${{ github.workspace }}/arm-sysroot/lib"
export PKG_CONFIG_PATH="${{ github.workspace }}/arm-sysroot/lib/pkgconfig"
if [ "${{ matrix.build-type }}" = "arm32" ]; then
../configure --host=arm-linux-gnueabihf --disable-fastopen;
else
../configure --host=aarch64-linux-gnu --disable-fastopen;
fi
elif [ "$LINKING" = "static" ]; then
../configure --enable-static --disable-fastopen;
elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then
../configure --enable-debug --enable-coverage --disable-shared --disable-fastopen;
elif [ "$DEBUG" = "debug" ]; then
../configure --enable-debug --disable-shared --disable-fastopen;
elif [ "$BUILD_TYPE" = "valgrind" ]; then
../configure --enable-debug --disable-fastopen --disable-valgrind-helgrind --disable-valgrind-drd --disable-valgrind-sgcheck;
elif [ "$BUILD_TYPE" = "iwyu" ]; then
../configure --disable-examples;
else
../configure --disable-fastopen;
fi
- name: Verify libhttpserver detected no digest auth (no-dauth test)
run: |
cd build ;
if grep -q "Digest Auth.*:.*no" config.log; then
echo "Verified: libhttpserver correctly detected digest auth is disabled" ;
else
echo "ERROR: libhttpserver did not detect that digest auth is disabled" ;
grep "Digest Auth" config.log || echo "Digest Auth line not found" ;
exit 1 ;
fi
if: ${{ matrix.build-type == 'no-dauth' }}
- name: Print config.log
shell: bash
run: |
cd build ;
cat config.log ;
if: ${{ failure() }}
# Make or run iwyu. If running iwyu, check for the result code to be 2 (IWYU always returns an error code, if it is 2, no corrections are necessary).
- name: Make or run IWYU
run: |
# IWYU always return an error code. If it returns "2" it indicates a success so we manage this within the function below.
function safe_make_iwyu() {
{
make -k CXX='/usr/local/bin/include-what-you-use -Xiwyu --mapping_file=${top_builddir}/../custom_iwyu.imp' CXXFLAGS="-std=c++11 -DHTTPSERVER_COMPILATION -D_REENTRANT $CXXFLAGS" ;
} || {
if [ $? -ne 2 ]; then
return 1;
else
return 0;
fi
}
return 0;
}
cd build ;
if [ "$BUILD_TYPE" = "iwyu" ]; then
safe_make_iwyu ;
else
make ;
fi
- name: Run tests
run: |
cd build ;
make check;
if: ${{ matrix.build-type != 'iwyu' && matrix.compiler-family != 'arm-cross' }}
- name: Print tests results
shell: bash
run: |
cd build ;
cat test/test-suite.log ;
if: ${{ failure() && matrix.build-type != 'iwyu' && matrix.compiler-family != 'arm-cross' }}
- name: Run Valgrind checks
run: |
cd build ;
make check-valgrind ;
if: ${{ matrix.build-type == 'valgrind' }}
- name: Print Valgrind memcheck results
shell: bash
run: |
cd build ;
if [ -f test/test-suite-memcheck.log ]; then
cat test/test-suite-memcheck.log ;
fi
if: ${{ always() && matrix.build-type == 'valgrind' }}
- name: Run cppcheck
run: |
cd src/ ;
cppcheck --error-exitcode=1 . ;
if: ${{ matrix.os-type == 'ubuntu' && matrix.compiler-family != 'arm-cross' }}
- name: Run performance tests (select)
run: |
cd build
cd examples
./benchmark_select 8080 $(nproc) &
sleep 5 && ab -n 1000000 -c 100 127.0.0.1:8080/plaintext
if: ${{ matrix.build-type == 'select' }}
- name: Run performance tests (nodelay)
run: |
cd build
cd examples
./benchmark_nodelay 8080 $(nproc) &
sleep 5 && ab -n 1000000 -c 100 127.0.0.1:8080/plaintext
if: ${{ matrix.build-type == 'nodelay' }}
- name: Run performance tests (threads)
run: |
cd build
cd examples
./benchmark_threads 8080 &
sleep 5 && ab -n 1000000 -c 100 127.0.0.1:8080/plaintext
if: ${{ matrix.build-type == 'threads' }}
- name: Generate coverage report
run: |
cd build
gcovr --root .. --filter '../src/' --xml coverage.xml --xml-pretty --print-summary --gcov-ignore-parse-errors=negative_hits.warn_once_per_file
if: ${{ matrix.os-type == 'ubuntu' && matrix.c-compiler == 'gcc' && matrix.debug == 'debug' && matrix.coverage == 'coverage' && success() }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/coverage.xml
fail_ci_if_error: false
if: ${{ matrix.os-type == 'ubuntu' && matrix.c-compiler == 'gcc' && matrix.debug == 'debug' && matrix.coverage == 'coverage' && success() }}