diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 316d300..a735231 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,22 @@ on: branches: [ master ] jobs: + check_cc: + name: Check Coding Conventions + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v2 + + - name: Install pip dependencies + run: pip install -r requirements.txt + + - name: Check code formatting + run: bash infra/scripts/check_formatting.sh . + build: name: ${{ matrix.platform.name }} runs-on: ${{ matrix.platform.os }} + needs: check_cc strategy: fail-fast: false @@ -21,10 +34,12 @@ jobs: steps: - uses: actions/checkout@v2 + + - name: Install pip dependencies + run: pip install -r requirements.txt - - name: Install dependencies && configure + - name: Install conan dependencies && configure run: | - pip install 'conan~=2.0' conan install . --build=missing --profile:all ${{github.workspace}}/.github/profiles/${{matrix.platform.profile}} -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=True - name: Build diff --git a/infra/hooks/pre-commit b/infra/hooks/pre-commit old mode 100644 new mode 100755 index 629a96a..9ad9a1c --- a/infra/hooks/pre-commit +++ b/infra/hooks/pre-commit @@ -46,6 +46,7 @@ EOF fi # Check code formatting +. env/bin/activate bash ./infra/scripts/check_formatting.sh $(pwd) FORMATTING_EC=$? if [[ $FORMATTING_EC -ne 0 ]]; then diff --git a/infra/scripts/apply_formatting.sh b/infra/scripts/apply_formatting.sh index 889ec86..5d7d42e 100644 --- a/infra/scripts/apply_formatting.sh +++ b/infra/scripts/apply_formatting.sh @@ -14,7 +14,7 @@ if [[ ! -d .git ]]; then fi echo "Applying code formatting..." -. env/bin/activate && find src/ include/ -regex ".*\.\(hpp\|cpp\|c\|h\)$" -execdir clang-format --style=LLVM -i {} + ; +find src/ include/ -regex ".*\.\(hpp\|cpp\|c\|h\)$" -execdir clang-format --style=LLVM -i {} + ; FORMATTING_EC=$? if [[ $FORMATTING_EC -ne 0 ]]; then exit 1 diff --git a/infra/scripts/check_formatting.sh b/infra/scripts/check_formatting.sh index 4e138eb..4814779 100644 --- a/infra/scripts/check_formatting.sh +++ b/infra/scripts/check_formatting.sh @@ -14,7 +14,7 @@ if [[ ! -d .git ]]; then fi echo "Checking code formatting..." -. env/bin/activate && find src/ include/ -regex ".*\.\(hpp\|cpp\|c\|h\)$" -execdir clang-format --style=LLVM --dry-run --Werror {} + ; +find src/ include/ -regex ".*\.\(hpp\|cpp\|c\|h\)$" -execdir clang-format --style=LLVM --dry-run --Werror {} + ; FORMATTING_EC=$? if [[ $FORMATTING_EC -ne 0 ]]; then exit 1 diff --git a/requirements.txt b/requirements.txt index 1a90aa8..37cd817 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ clang-format==20.1.0 +conan~=2.0