Skip to content

test: add comprehensive test suite #18

test: add comprehensive test suite

test: add comprehensive test suite #18

Workflow file for this run

name: CI
on:
push:
branches: [main, '**']
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build (${{ matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
compiler: [clang, gcc]
exclude:
- os: macos-latest
compiler: gcc
- os: windows-latest
compiler: gcc
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set compiler (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
echo "CXX=g++" >> $GITHUB_ENV
else
echo "CXX=clang++" >> $GITHUB_ENV
fi
- name: Set compiler (macOS)
if: matrix.os == 'macos-latest'
run: echo "CXX=clang++" >> $GITHUB_ENV
- name: Set compiler (Windows)
if: matrix.os == 'windows-latest'
run: echo "CXX=clang++" >> $GITHUB_ENV
- name: Configure CMake
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DXCMIXIN_BUILD_EXAMPLES=ON -DXCMIXIN_BUILD_TESTS=ON
- name: Build
run: cmake --build build --parallel
- name: Run tests
run: ctest --test-dir build --output-on-failure
- name: Build and Run examples (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
for exe in build/examples/*_example; do
if [ -f "$exe" ]; then
"$exe"
fi
done
- name: Build and Run examples (Windows)
if: matrix.os == 'windows-latest'
run: |
Get-ChildItem -Path build/examples -Filter "*.exe" | ForEach-Object { & $_.FullName }