Add clang-format check for libpiper #28
Workflow file for this run
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: Build libpiper | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'libpiper/**' | |
| - '.github/workflows/build-libpiper.yml' | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| format-check: | |
| name: Check Formatting | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: libpiper | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install clang-format | |
| run: sudo apt-get update && sudo apt-get install -y clang-format | |
| - name: Configure for format check | |
| run: cmake -B build -DCLANG_FORMAT_ARGS="--dry-run;--Werror" | |
| - name: Run clang-format check | |
| run: cmake --build build --target format | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| defaults: | |
| run: | |
| working-directory: libpiper | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Configure | |
| run: cmake -B build -DPIPER_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX="$PWD/install" | |
| - name: Build | |
| run: cmake --build build --config Release | |
| - name: Test | |
| run: ctest -C Release --output-on-failure --test-dir build | |
| - name: Install | |
| run: cmake --install build --config Release | |
| - name: Upload install artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libpiper-${{ matrix.os }} | |
| path: libpiper/install/ |