Skip to content

Fix SDK compat issues in 4.12 #1041

Fix SDK compat issues in 4.12

Fix SDK compat issues in 4.12 #1041

name: Check Code Style
on:
push:
branches: [ master, 'robolectric-*.x' ]
paths-ignore:
- '**.md'
pull_request:
branches: [ master, google ]
paths-ignore:
- '**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check_code_style:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Download google-java-format 1.9
run: |
curl -L -o $HOME/google-java-format.jar https://github.com/google/google-java-format/releases/download/v1.15.0/google-java-format-1.15.0-all-deps.jar
curl -L -o $HOME/google-java-format-diff.py https://raw.githubusercontent.com/google/google-java-format/v1.15.0/scripts/google-java-format-diff.py
chmod +x $HOME/google-java-format-diff.py
- name: Check Java formatting
run: |
base_branch="${{ github.event.pull_request.base.ref }}"
echo "Running google-java-format-diff against 'origin/$base_branch'"
git fetch origin "$base_branch" --depth 1
diff=$(git diff -U0 $(git merge-base HEAD origin/$base_branch) | $HOME/google-java-format-diff.py --google-java-format-jar=$HOME/google-java-format.jar -p1)
if [[ $diff ]]; then
echo "Please run google-java-format on the changes in this pull request"
git diff -U0 $(git merge-base HEAD origin/$base_branch) | $HOME/google-java-format-diff.py --google-java-format-jar=$HOME/google-java-format.jar -p1
exit 1
fi
- name: Check Kotlin formatting
run: |
./gradlew spotlessCheck
- name: Check Kotlin Code Style
run: |
./gradlew detekt