build: use common Hiero Gradle config #1290
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
name: "PR Gradle Checks" | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
branches: | |
- "*" | |
defaults: | |
run: | |
shell: bash | |
env: | |
GRADLE_EXEC: ./gradlew | |
permissions: | |
contents: read | |
jobs: | |
compile: | |
name: "Gradle Checks" | |
runs-on: block-node-linux-medium | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: Expand Shallow Clone for Spotless | |
run: | | |
if [ -f .git/shallow ]; then | |
git fetch --unshallow --no-recurse-submodules | |
else | |
echo "Repository is not shallow, no need to unshallow." | |
fi | |
- name: Set up JDK 21 | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | |
with: | |
distribution: "temurin" | |
java-version: "21.0.4" | |
- name: Cache Gradle packages | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build | |
id: gradle-build | |
run: ${GRADLE_EXEC} assemble --scan | |
- name: Style Check | |
id: spotless-check | |
run: ${GRADLE_EXEC} qualityCheck --continue --scan | |
- name: Unit Tests | |
id: unit-tests | |
run: ${GRADLE_EXEC} check --scan | |
- name: Upload coverage report | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |