From d63dc6c37b83d0593b4207214efb421834012829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= Date: Mon, 9 Dec 2024 15:30:36 +1100 Subject: [PATCH] Add git-clang-format GitHub workflow This workflow is based on PREUPLOAD.cfg in AOSP. --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31df80830..9d8afe0cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,27 @@ jobs: include-hidden-files: true if-no-files-found: error + clang_format_check: + # Only run on pull requests. + if: ${{ startsWith(github.ref, 'refs/pull/') }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get git-clang-format + # Uses the most recent clang-format on Ubuntu. + run: | + sudo apt-get -qq update + sudo apt-get -qq install -y --no-install-recommends clang-format + + - name: Run git-clang-format against source branch + run: | + git clang-format --style=file --diff origin/$GITHUB_BASE_REF '*.c' '*.h' '*.cc' '*.cpp' '*.java' + build: needs: boringssl_clone