style: format code with clang-format #3
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, master] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake g++ libssl-dev | |
| - name: Configure CMake | |
| run: cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build -j$(nproc) | |
| - name: Run tests | |
| run: cd build && ctest --output-on-failure | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: brew install cmake openssl | |
| - name: Configure CMake | |
| run: cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| env: | |
| OPENSSL_ROOT_DIR: /usr/local/opt/openssl | |
| - name: Build | |
| run: cmake --build build -j$(sysctl -n hw.ncpu) | |
| - name: Run tests | |
| run: cd build && ctest --output-on-failure | |
| format-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install clang-format | |
| run: sudo apt-get install -y clang-format | |
| - name: Check code format | |
| run: | | |
| find src tests -name "*.cpp" -o -name "*.hpp" -o -name "*.h" | while read file; do | |
| if [ -f "$file" ]; then | |
| diff -u "$file" <(clang-format "$file") || exit 1 | |
| fi | |
| done | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup MSVC | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Install dependencies | |
| run: | | |
| choco install openssl -y | |
| echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64" >> $env:GITHUB_ENV | |
| - name: Configure CMake | |
| run: cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build --config Release -j | |
| - name: Run tests | |
| run: cd build && ctest -C Release --output-on-failure |