From b54f0e2474927e2b35a5e3267737017236b55c35 Mon Sep 17 00:00:00 2001 From: Joonas Kerttula Date: Fri, 30 Aug 2024 13:03:47 +0300 Subject: [PATCH] ci: fix google-java-format --- .github/workflows/ci.yml | 24 +++++++++++++++++++++++- CONTRIBUTING.md | 4 ++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d68ad1..654c590 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,11 +47,33 @@ jobs: uses: actions/checkout@v4 - name: Install clang-format and google-java-format - run: sudo apt-get install clang-format-18 google-java-format + run: sudo apt-get install clang-format - name: Check Objective-C formatting run: ./scripts/format-objc.sh --check + - name: Install JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + java-package: 'jdk' + + - name: Download google-java-format + run: | + GOOGLE_JAVA_FORMAT_VERSION=1.23.0 + GOOGLE_JAVA_FORMAT_URL=https://github.com/google/google-java-format/releases/download/v${GOOGLE_JAVA_FORMAT_VERSION}/google-java-format-${GOOGLE_JAVA_FORMAT_VERSION}-all-deps.jar + mkdir -p $HOME/google-java-format + curl -L -o $HOME/google-java-format/google-java-format.jar $GOOGLE_JAVA_FORMAT_URL + + - name: Create google-java-format wrapper script + run: | + cat << 'EOF' > /usr/local/bin/google-java-format + #!/bin/sh + exec java -jar "$HOME/google-java-format/google-java-format.jar" "$@" + EOF + chmod +x /usr/local/bin/google-java-format + - name: Check Java formatting run: ./scripts/format-java.sh --check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 170e9b8..6c3d2b9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,8 +29,8 @@ This project follows - [git](https://git-scm.com) (used for source version control). - An IDE such as [Android Studio](https://developer.android.com/studio) or [Visual Studio Code](https://code.visualstudio.com/). - [addlicense](https://github.com/google/addlicense) -- [google-java-format](https://github.com/google/google-java-format) (used to format Java code). -- [clang-format v18](https://clang.llvm.org/docs/ClangFormat.html) (used to format Objective-C code). +- [google-java-format Version 1.23.0](https://github.com/google/google-java-format) (used to format Java code). +- [clang-format](https://clang.llvm.org/docs/ClangFormat.html) (used to format Objective-C code). ## 2. Forking & cloning the repository