| name: Setup Gradle |
| description: Sets up the environment to run Gradle |
| |
| inputs: |
| gradle-jvm-args: |
| description: "JVM args to pass to Gradle" |
| required: true |
| # Github-Hosted nodes have only 7GB of RAM available. Looking at build scans Gradle process requires slightly more than 0.5GB. |
| # Keeping this setting low, allows other, forked JVM processes (like tests) to use remaining memory. |
| # Increase this value, only if GC time visible in build scans will take more than a few seconds. |
| default: "-Xmx1g" |
| additional-java-versions: |
| description: "Java versions installed on the side of the default Java version required by the build" |
| required: false |
| |
| runs: |
| using: composite |
| |
| steps: |
| - uses: actions/setup-java@v5 |
| with: |
| distribution: 'zulu' |
| java-version: | # last version (set as default) should match all `jvmToolchain(xxx)` calls in the project |
| ${{ inputs.additional-java-versions }} |
| 25 |
| |
| # Please note these settings will override the ones set via `gradle.properties` committed to the repository - https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties |
| # List of optimizations: |
| # - `jvm-args` fine-tuned to the CI runner & tasks being invoked |
| # - disabled File System Watching to improve Windows build times. CI runs don't modify source files, hence they don't need to pay extra cost to efficiently track changed files. |
| - name: Optimize Gradle build properties for CI |
| run: | |
| mkdir -p ~/.gradle |
| printf "org.gradle.jvmargs=${{ inputs.gradle-jvm-args }}\n" >> ~/.gradle/gradle.properties |
| printf "org.gradle.vfs.watch=false\n" >> ~/.gradle/gradle.properties |
| shell: bash |
| |
| - uses: gradle/actions/setup-gradle@v5 |