diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..3b434251 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + build_type: [Release, Debug] + + steps: + - uses: actions/checkout@v3 + + - name: Configure CMake + run: cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} + + - name: Run tests + run: cd build && ctest -C ${{ matrix.build_type }} --output-on-failure diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml new file mode 100644 index 00000000..98ba1036 --- /dev/null +++ b/.github/workflows/formatting.yml @@ -0,0 +1,38 @@ +name: Code Formatting + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + format: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v5 + + # Install clang-format if needed + - name: Install clang-format (Linux) + if: matrix.os == 'ubuntu-latest' + run: sudo apt-get update && sudo apt-get install -y clang-format + + - name: Install clang-format (macOS) + if: matrix.os == 'macos-latest' + run: brew install clang-format || true + + # Check formatting + - name: Check C/C++ formatting + run: | + misformatted=$(find . -name '*.c' -o -name '*.h' -print0 | xargs -0 clang-format -style=file -output-replacements-xml | grep "