Skip to content

Commit

Permalink
Add sanitizers for Bazel CI (jbcoe#35)
Browse files Browse the repository at this point in the history
* Add sanitizers for Bazel CI

* Fix typo
  • Loading branch information
jbcoe authored Sep 24, 2023
1 parent c20885a commit 30c5f26
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
build --cxxopt='-std=c++20'

build:asan --strip=never
build:asan --copt -fsanitize=address
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -O1
build:asan --copt -g
build:asan --copt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address

build:ubsan --strip=never
build:ubsan --copt -fsanitize=undefined
build:ubsan --copt -DADDRESS_SANITIZER
build:ubsan --copt -O1
build:ubsan --copt -g
build:ubsan --copt -fno-omit-frame-pointer
build:ubsan --linkopt -fsanitize=undefined

build:tsan --strip=never
build:tsan --copt -fsanitize=thread
build:tsan --copt -DADDRESS_SANITIZER
build:tsan --copt -O1
build:tsan --copt -g
build:tsan --copt -fno-omit-frame-pointer
build:tsan --linkopt -fsanitize=thread
26 changes: 25 additions & 1 deletion .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,31 @@ on:

jobs:
build:
name: ${{ matrix.settings.name }}
runs-on: ubuntu-latest
strategy:
matrix:
settings:
- {
name: "debug",
flags: "-c dbg",
}
- {
name: "optimized",
flags: "-c opt",
}
- {
name: "address sanitizer",
flags: "--config=asan",
}
- {
name: "undefined behaviour sanitizer",
flags: "--config=ubsan",
}
- {
name: "thread sanitizer",
flags: "--config=tsan",
}
steps:
- uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
Expand All @@ -17,4 +41,4 @@ jobs:
with:
path: "~/.cache/bazel"
key: bazel
- run: bazel test --action_env=BAZEL_CXXOPTS="-std=c++20" //...
- run: bazel test --action_env=BAZEL_CXXOPTS="-std=c++20" ${{matrix.settings.flags}} //...

0 comments on commit 30c5f26

Please sign in to comment.