diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index ebac4e4..aa85ae6 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -3,7 +3,7 @@ name: CI Build on: pull_request: - workflow_dispatch: + workflow_dispatch: jobs: build: @@ -40,3 +40,38 @@ jobs: ./build/ace-qwen3 --help 2>&1 | head -5 ./build/dit-vae --help 2>&1 | head -5 ./build/quantize --help 2>&1 | head -3 + + lint: + name: Lint & Static Analysis + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v4 + + - name: Install lint tools + run: | + sudo apt-get update -qq + sudo apt-get install -y -qq clang-format clang-tidy cppcheck + + - name: Check trailing whitespace + continue-on-error: true + run: | + if grep -rIn --exclude-dir=.git --exclude="*.md,*.log" "[[:blank:]]$" .; then + echo "Trailing whitespace detected!" + exit 1 + fi + + - name: Run clang-format (check mode) + run: | + find . \ + \( -path './.git' -o -path './ggml' -o -path './build' \) -prune -o \ + -type f \( -name '*.c' -o -name '*.h' -o -name '*.cc' -o -name '*.cpp' -o -name '*.hpp' \) \ + -print0 | xargs -0 clang-format --dry-run --Werror + + - name: Run cppcheck + run: | + cppcheck --enable=all --error-exitcode=1 --inline-suppr \ + --suppress=missingIncludeSystem \ + --suppress=unusedFunction \ + -i ggml -i build -i .git \ + .