diff --git a/.github/workflows/lint-clang.yaml b/.github/workflows/lint-clang.yaml new file mode 100644 index 00000000..718236d2 --- /dev/null +++ b/.github/workflows/lint-clang.yaml @@ -0,0 +1,34 @@ +name: Lint Clang + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + types: + - checks_requested + +jobs: + lint: + if: false # temporarily disable clang linting + name: Run clang lint + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Run clang lint + run: yarn lint-clang diff --git a/package.json b/package.json index a8b9e272..6d6fc631 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,12 @@ "test": "jest --passWithNoTests", "typecheck": "tsc", "lint": "eslint \"**/*.{js,ts,tsx}\"", + "lint-clang:ios": "find ios/ \\( -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.mm\" \\) | grep -v -e Pods -e build | xargs clang-format -i -n --Werror", + "lint-clang:ios:fix": "find ios/ \\( -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.mm\" \\) | grep -v -e Pods -e build | xargs clang-format -i", + "lint-clang:android": "find android/ \\( -iname \"*.h\" -o -iname \"*.cpp\" \\) | grep -v -e build | xargs clang-format -i -n --Werror", + "lint-clang:android:fix": "find android/ \\( -iname \"*.h\" -o -iname \"*.cpp\" \\) | grep -v -e build | xargs clang-format -i", + "lint-clang": "yarn lint-clang:ios && yarn lint-clang:android", + "lint-clang:fix": "yarn lint-clang:ios:fix && yarn lint-clang:android:fix", "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib", "prepare": "bob build", "release": "release-it",