fix cross-platofrm compatibility issues and build up CI #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "CMakeLists.txt" | |
| - ".github/workflows/ci.yml" | |
| - "src/**" | |
| - "include/**" | |
| - "tests/**" | |
| - "examples/**" | |
| - "**/*.c" | |
| - "**/*.cpp" | |
| - "**/*.h" | |
| - "**/*.hpp" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "CMakeLists.txt" | |
| - ".github/workflows/ci.yml" | |
| - "src/**" | |
| - "include/**" | |
| - "tests/**" | |
| - "examples/**" | |
| - "**/*.c" | |
| - "**/*.cpp" | |
| - "**/*.h" | |
| - "**/*.hpp" | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-22.04, debian-trixie] | |
| runs-on: ${{ matrix.os == 'ubuntu-22.04' && 'ubuntu-22.04' || 'ubuntu-latest' }} | |
| container: ${{ matrix.os == 'debian-trixie' && 'debian:trixie' || '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake ninja-build gcc g++ | |
| - name: Install dependencies (Debian Trixie) | |
| if: matrix.os == 'debian-trixie' | |
| run: | | |
| apt-get update | |
| apt-get install -y cmake ninja-build gcc g++ | |
| - name: Configure | |
| run: cmake -S . -B build -G Ninja -DBUILD_TESTING=ON | |
| - name: Build | |
| run: cmake --build build | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure | |
| build-arm64: | |
| name: Build (ARM64) | |
| runs-on: ubuntu-22.04 | |
| container: | |
| image: ubuntu:22.04 | |
| # request ARM64 emulation — GitHub runners will use qemu for multiarch containers | |
| options: --platform linux/arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y cmake ninja-build gcc g++ libc6-dev | |
| - name: Configure | |
| run: cmake -S . -B build -G Ninja -DBUILD_TESTING=ON | |
| - name: Build | |
| run: cmake --build build | |
| - name: Test | |
| run: ctest --test-dir build --output-on-failure |