From 0376533c04e07784b69590daab5684ac51730c11 Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Wed, 5 Apr 2023 20:41:47 +0300 Subject: [PATCH] cicd: add a test job with enabled UBSAN --- .github/workflows/build.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27b31085..cf3628a1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -169,3 +169,34 @@ jobs: lib/binding_web/tree-sitter.wasm if-no-files-found: error retention-days: 7 + + check_undefined_behaviour: + name: Undefined behaviour checks + runs-on: ubuntu-latest + env: + TREE_SITTER: ${{ github.workspace }}/target/release/tree-sitter + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Install UBSAN library + run: sudo apt-get install -y libubsan1 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Build CLI + run: cargo build --release + + - name: Fetch fixtures + run: script/fetch-fixtures + + - name: Generate fixtures + run: script/generate-fixtures + + - name: Run main tests with undefined behaviour sanitizer (UBSAN) + env: + UBSAN_OPTIONS: halt_on_error=1 + CFLAGS: -fsanitize=undefined + RUSTFLAGS: -lubsan + run: cargo test -- --test-threads 1