| 1 |
name: Run sanitizer checks |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
push: |
| 6 |
branches: [ master ] |
| 7 |
paths: |
| 8 |
- '**.h' |
| 9 |
- '**.c' |
| 10 |
|
| 11 |
pull_request: |
| 12 |
branches: [ master ] |
| 13 |
paths: |
| 14 |
- '**.h' |
| 15 |
- '**.c' |
| 16 |
|
| 17 |
permissions: |
| 18 |
contents: read |
| 19 |
|
| 20 |
jobs: |
| 21 |
build: |
| 22 |
runs-on: ubuntu-latest |
| 23 |
name: Build with ${{ matrix.sanitizer }} sanitizer for ${{ matrix.ucs }} |
| 24 |
strategy: |
| 25 |
matrix: |
| 26 |
ucs: [ucs2, ucs4] |
| 27 |
sanitizer: [address, leak, undefined] |
| 28 |
include: |
| 29 |
- sanitizer: "address" |
| 30 |
options: "ASAN_OPTIONS=detect_leaks=0" |
| 31 |
- sanitizer: "leak" |
| 32 |
options: "LSAN_OPTIONS=fast_unwind_on_malloc=0" |
| 33 |
- sanitizer: "undefined" |
| 34 |
options: "UBSAN_OPTIONS=halt_on_error=1" |
| 35 |
steps: |
| 36 |
- name: Harden Runner |
| 37 |
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 |
| 38 |
with: |
| 39 |
egress-policy: audit |
| 40 |
|
| 41 |
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| 42 |
- name: Install dependencies |
| 43 |
run: sudo apt-get update -qq && sudo apt-get install -y libyaml-dev |
| 44 |
- name: Autogen |
| 45 |
run: ./autogen.sh |
| 46 |
- name: Configure |
| 47 |
run: CFLAGS="-fsanitize=${{ matrix.sanitizer }} -g" ./configure |
| 48 |
if: matrix.ucs == 'ucs2' |
| 49 |
- name: Configure with ucs4 |
| 50 |
run: CFLAGS="-fsanitize=${{ matrix.sanitizer }} -g" ./configure --enable-ucs4 |
| 51 |
if: matrix.ucs == 'ucs4' |
| 52 |
- name: Make check |
| 53 |
run: ${{ matrix.options }} make check |
| 54 |
- name: Store the test suite log |
| 55 |
if: ${{ always() }} |
| 56 |
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a |
| 57 |
with: |
| 58 |
name: test-suite-${{ matrix.ucs }}-${{ matrix.sanitizer }}.log |
| 59 |
path: tests/test-suite.log |