name: Style Check

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

permissions:
  contents: read

jobs:
  # Style check with clang-format 18
  style-check:
    runs-on: ubuntu-latest

    steps:
    - name: Install packages
      run: |
        wget https://apt.llvm.org/llvm.sh
        chmod +x llvm.sh
        sudo ./llvm.sh 18
        sudo apt install -y nasm clang-format-18

    - name: Checkout repo
      uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
      with:
        repository: 'intel/intel-ipsec-mb'

    - name: Configure CMake
      run: cmake -B ${{github.workspace}}/build -DCLANG_FORMAT_BIN=clang-format-18

    - name: Run style check
      run: cmake --build ${{github.workspace}}/build --target style
