-
Notifications
You must be signed in to change notification settings - Fork 8
Add sanitizer reusable workflow #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| name: Sanitizers (Reusable) | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| sanitizer_configs: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shoudn't that be just bazel config ? Then user ofc will provie them. |
||
| description: 'Comma-separated list of sanitizer configs (e.g., asan_ubsan_lsan,tsan)' | ||
| required: false | ||
| default: 'asan_ubsan_lsan,tsan' | ||
| type: string | ||
| test_targets: | ||
| description: 'Bazel test targets' | ||
| required: false | ||
| default: '//tests/...' | ||
| type: string | ||
| bazelisk_version: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this is needed? |
||
| description: 'Bazelisk version' | ||
| required: false | ||
| default: '1.26.0' | ||
| type: string | ||
| runner_label: | ||
| description: 'Runner label fallback' | ||
| required: false | ||
| default: 'ubuntu-latest' | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| prepare-matrix: | ||
| name: Prepare Matrix | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| configs: ${{ steps.parse.outputs.configs }} | ||
| steps: | ||
| - name: Parse configs | ||
| id: parse | ||
| run: | | ||
| CONFIGS='${{ inputs.sanitizer_configs }}' | ||
| CONFIGS=$(echo "$CONFIGS" | tr -d ' ' | tr ',' '\n' | jq -R . | jq -s .) | ||
| echo "configs=$CONFIGS" >> $GITHUB_OUTPUT | ||
|
|
||
| sanitizer-tests: | ||
| name: ${{ matrix.sanitizer_config }} | ||
| runs-on: ${{ vars.REPO_RUNNER_LABELS && fromJSON(vars.REPO_RUNNER_LABELS) || inputs.runner_label }} | ||
| needs: prepare-matrix | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| sanitizer_config: ${{ fromJson(needs.prepare-matrix.outputs.configs) }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4.2.2 | ||
| with: | ||
| ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }} | ||
| repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | ||
|
|
||
| - name: Setup Bazel | ||
| uses: bazel-contrib/setup-bazel@0.18.0 | ||
| with: | ||
| bazelisk-version: ${{ inputs.bazelisk_version }} | ||
| disk-cache: ${{ github.workflow }} | ||
| repository-cache: true | ||
| bazelisk-cache: true | ||
| cache-save: ${{ github.event_name == 'push' }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also only for main |
||
|
|
||
| - name: Run tests | ||
| run: | | ||
| bazel test \ | ||
| --config=${{ matrix.sanitizer_config }} \ | ||
| ${{ inputs.test_targets }} \ | ||
| --test_output=errors \ | ||
| --verbose_failures | ||
|
|
||
| - name: Upload logs | ||
| if: failure() | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: testlogs-${{ matrix.sanitizer_config }}-${{ github.run_id }} | ||
| path: bazel-testlogs/**/test.log | ||
| if-no-files-found: warn | ||
| retention-days: 7 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C++ Sanitizers?