| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| name: ASAN and UBSAN Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '**' | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| # Run for code/build changes and this suite's workflow dependencies. | |
| - '**' | |
| - '!.asf.yaml' | |
| - '!.devcontainer/**' | |
| - '!.github/**' | |
| - '!**/*.md' | |
| - '!dev/**' | |
| - '!mkdocs/**' | |
| - '.github/workflows/sanitizer_test.yml' | |
| - '.github/actions/**' | |
| - '.github/lsan-suppressions.txt' | |
| - '.github/ubsan-suppressions.txt' | |
| concurrency: | |
| group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| sanitizer-test: | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| name: "ASAN and UBSAN Tests" | |
| runs-on: ubuntu-26.04 | |
| steps: | |
| - name: Checkout iceberg-cpp | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install dependencies | |
| shell: bash | |
| run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev | |
| - name: Set up sccache | |
| uses: ./.github/actions/setup-sccache | |
| with: | |
| key-prefix: sccache-sanitizer-ubuntu | |
| - name: Configure and Build with ASAN & UBSAN | |
| env: | |
| CC: gcc-14 | |
| CXX: g++-14 | |
| run: | | |
| mkdir build && cd build | |
| cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DICEBERG_ENABLE_ASAN=ON -DICEBERG_ENABLE_UBSAN=ON \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache | |
| cmake --build . --verbose | |
| - name: Save sccache | |
| if: always() | |
| uses: ./.github/actions/save-sccache | |
| with: | |
| key-prefix: sccache-sanitizer-ubuntu | |
| job-status: ${{ job.status }} | |
| - name: Run Tests | |
| working-directory: build | |
| env: | |
| ASAN_OPTIONS: log_path=${{ github.workspace }}/asan.log:detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=1:detect_container_overflow=0 | |
| LSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/lsan-suppressions.txt | |
| UBSAN_OPTIONS: log_path=${{ github.workspace }}/ubsan.log:halt_on_error=1:print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt | |
| run: | | |
| ctest --output-on-failure | |
| - name: Save the test output | |
| if: always() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: test-output | |
| path: | | |
| asan.log* | |
| ubsan.log* | |
| build/Testing/Temporary/LastTest.log | |
| build/Testing/Temporary/LastTestsFailed.log |