Skip to content

Commit d4c28ce

Browse files
committed
CI: add optional build with a clang sanitizer
1 parent a2cc8d4 commit d4c28ce

File tree

4 files changed

+75
-4
lines changed

4 files changed

+75
-4
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ insert_final_newline = true
66
charset = utf-8
77
indent_style = tab
88

9+
[*.yaml]
10+
indent_style = space
11+
indent_size = 2
12+

.github/workflows/cppcmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: C/C++ CI
33
on:
44
push:
55
branches: ['*']
6-
tags:
7-
paths_ignore: ['docs/**', '.travis.yml']
6+
tags: ['*']
7+
paths-ignore: ['docs/**', '.travis.yml']
88
pull_request:
99
release:
1010
types: ['created']

.github/workflows/mingw_static.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ name: MinGW Windows static test
33
on:
44
push:
55
branches: ['*']
6-
tags:
7-
paths_ignore: ['docs/**', '.travis.yml']
6+
paths:
7+
- '**'
8+
- '!docs/**'
9+
- '!.github/**'
10+
- '.github/workflows/mingw_static.yml'
811
pull_request:
912

1013
jobs:

.github/workflows/sanitize.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Clang Sanitizer
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
cmakeextra:
7+
description: "Extra CMake options"
8+
required: false
9+
default: ""
10+
sanitizer:
11+
description: 'Sanitizer to run'
12+
required: true
13+
default: 'address'
14+
options: ['address', 'thread', 'memory', 'undefined']
15+
type: choice
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
jobs:
22+
build:
23+
name: "${{ github.event.inputs.sanitizer }}"
24+
runs-on: 'ubuntu-latest'
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Configure CMake
29+
run: |
30+
wget https://apt.llvm.org/llvm-snapshot.gpg.key
31+
echo "deb [signed-by=$PWD/llvm-snapshot.gpg.key] http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee /etc/apt/sources.list.d/llvm.list
32+
sudo apt update
33+
sudo apt install -y libpugixml-dev clang-13
34+
# linking a C++ library to a C program fails with ubsan enabled; disable lslver for this run
35+
sed -i -e'/lslver/d' CMakeLists.txt
36+
cmake --version
37+
cmake -S . -B build \
38+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
39+
-DCMAKE_C_COMPILER=clang-13 \
40+
-DCMAKE_{CXX_COMPILER,LINKER}=clang++-13 \
41+
-DCMAKE_{C,CXX,EXE_LINKER,SHARED_LINKER}_FLAGS="-fsanitize=${{ github.event.inputs.sanitizer }}" \
42+
-DLSL_COMFY_DEFAULTS=ON \
43+
-DLSL_UNITTESTS=ON \
44+
-DLSL_BENCHMARKS=ON \
45+
-DLSL_BUILD_EXAMPLES=OFF \
46+
-DLSL_BUNDLED_PUGIXML=OFF \
47+
-DLSL_SLIMARCHIVE=ON \
48+
-DLSL_OPTIMIZATIONS=ON \
49+
-Dlslgitrevision=${{ github.sha }} \
50+
-Dlslgitbranch=${{ github.ref }} \
51+
${{ github.event.inputs.cmakeextra }}
52+
echo ${PWD}
53+
54+
- name: make
55+
run: cmake --build build --config RelWithDebInfo -j
56+
57+
- name: unit tests (internal functions)
58+
run: catchsegv build/testing/lsl_test_internal --order rand --wait-for-keypress never --durations yes
59+
timeout-minutes: 10
60+
61+
- name: unit tests (exported functions)
62+
run: catchsegv build/testing/lsl_test_exported --order rand --wait-for-keypress never --durations yes
63+
timeout-minutes: 10
64+
if: ${{ success() || failure() }}

0 commit comments

Comments
 (0)