Skip to content

Add Asan

Add Asan #9

Workflow file for this run

name: C++ CI

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

(Line: 32, Col: 17): Unexpected symbol: '+'. Located at position 15 within expression: fromJSON('["' + needs.detect-examples.outputs.folders | replace(' ', '","') + '"]'), (Line: 32, Col: 17): Unexpected value '${{ fromJSON('["' + needs.detect-examples.outputs.folders | replace(' ', '","') + '"]') }}'
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# Step 1: dynamically detect example folders
detect-examples:
runs-on: ubuntu-latest
outputs:
folders: ${{ steps.set-folders.outputs.folders }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Detect example folders
id: set-folders
run: |
folders=$(find . -maxdepth 1 -type d -not -name '.' -exec test -f '{}/Makefile' \; -print | sed 's|^\./||' | tr '\n' ' ')
echo "Detected folders: $folders"
echo "::set-output name=folders::$folders"
# Step 2: build and run examples in parallel using a matrix
build-and-run:
needs: detect-examples
runs-on: ubuntu-latest
strategy:
matrix:
folder: ${{ fromJSON('["' + needs.detect-examples.outputs.folders | replace(' ', '","') + '"]') }}
sanitizer: [address, thread, undefined]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential g++ clang
- name: Build example
run: |
echo "Building ${{ matrix.folder }} with SANITIZE=${{ matrix.sanitizer }}"
make -C ${{ matrix.folder }} SANITIZE=${{ matrix.sanitizer }}
- name: Run example
run: |
echo "Running ${{ matrix.folder }} with SANITIZE=${{ matrix.sanitizer }}"
make -C ${{ matrix.folder }} SANITIZE=${{ matrix.sanitizer }} run