diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..dde92bf --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,9 @@ +--- +Checks: 'readability-function-size, readability-math-missing-parentheses, readability-duplicate-include' +WarningsAsErrors: '.*' + +CheckOptions: + - key: readability-function-size.LineThreshold + value: '25' + - key: readability-function-size.ParameterThreshold + value: '5' diff --git a/.github/workflows/norm.yml b/.github/workflows/norm.yml new file mode 100644 index 0000000..82824e0 --- /dev/null +++ b/.github/workflows/norm.yml @@ -0,0 +1,38 @@ +name: Norm + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + norm: + runs-on: ubuntu-latest + steps: + - name: Checkout repository ${{ github.repository }} on a branch ${{ github.ref_name }} triggered by ${{ github.event_name }} + uses: actions/checkout@v4 + + - run: "echo the ${{ github.repository }} has been cloned in the container !" + + - name: 🔄 Installing task... + uses: arduino/setup-task@v2 + with: + version: 3.x + + - uses: actions/setup-python@v5 + + - name: 🔄 Installing Meson package build system... + run: pip install meson + + - name: 🔄 Installing Dependencies... + run: | + echo "📦 Installing libcriterion-dev, Ninja" + sudo apt-get update && sudo apt-get install -y libcriterion-dev ninja-build clang-tidy + echo "✅ Dependencies installed!" + + - name: Run build release task... + run: | + echo "🏗️ Setting up Meson build system..." + task build + echo "🔄 Check the Norm..." + task norm diff --git a/Taskfile.yml b/Taskfile.yml index ca492f3..a01eb87 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -30,6 +30,16 @@ tasks: silent: true desc: "Build the project in release build in stripped mode" + norm: + platforms: ["linux"] + preconditions: + - sh: 'test -d build' + msg: "Norm required compile_commands.json files please build the project before !" + cmds: + - CLANG_TIDY=$(clang-tidy -p ./build src/**/*.c | grep "warning"); [[ ! -z "$CLANG_TIDY" ]] && echo $CLANG_TIDY && exit 1 || exit 0; + silent: true + desc: "Pass the norm on the project" + build-dev: preconditions: - sh: '{{if eq OS "windows"}} powershell.exe -Command Test-Path dist {{else}} test ! -d dist {{end}}'