Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 29, 2025

This PR enables Gradle caching in both build.yml and windows-build.yml GitHub Actions workflows to improve build performance for Java components built with Gradle.

Problem

Previously, Gradle dependencies and build cache were not being cached between workflow runs in either workflow, causing slower build times and unnecessary network usage. The build.yml workflow was particularly affected because its make command implicitly calls ./gradlew shadowJar in the libcobj directory, but without any caching optimization.

Solution

Added the gradle/actions/setup-gradle@v3 step to both workflows:

  • windows-build.yml: Caches dependencies for the explicit ./gradlew shadowJar command
  • build.yml: Caches dependencies for the implicit ./gradlew shadowJar called by the make command

Both actions are configured with gradle-version: wrapper to respect the project's Gradle wrapper configuration (currently Gradle 8.2.1).

Benefits

  • Faster builds: Gradle dependencies, wrapper, and build cache are automatically cached between runs
  • Reduced network usage: Dependencies are only downloaded when they change
  • Better reliability: Consistent Gradle wrapper usage across both workflows
  • No breaking changes: Existing build logic remains unchanged, only caching is added
  • Future-proof: Uses the recommended gradle/actions/setup-gradle action instead of the deprecated gradle/gradle-build-action

Technical Details

The gradle/actions/setup-gradle action automatically handles caching of:

  • Gradle wrapper distribution
  • Gradle dependency cache
  • Gradle build cache
  • Configuration cache (when enabled)

The build.yml workflow benefits from this caching because when it runs make, the libcobj/Makefile.am executes ./gradlew shadowJar to build the Java library components.

Fixes #396.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits August 29, 2025 02:50
Co-authored-by: yutaro-sakamoto <80912876+yutaro-sakamoto@users.noreply.github.com>
Co-authored-by: yutaro-sakamoto <80912876+yutaro-sakamoto@users.noreply.github.com>
Copilot AI changed the title [WIP] Enable gradle cache in GitHub Actions Enable Gradle cache in GitHub Actions workflows Aug 29, 2025
Copilot AI requested a review from yutaro-sakamoto August 29, 2025 02:52
Copilot finished work on behalf of yutaro-sakamoto August 29, 2025 02:52
@yutaro-sakamoto
Copy link
Contributor

@copilot
このリポジトリではlibcobj/ディレクトリがgradleプロジェクトなのでそれを踏まえて修正できる?

The create-release.yml workflow also uses Gradle for publishing packages but was missing the gradle-build-action caching configuration. This adds the proper setup step with gradle-version: wrapper to enable caching for the publish job as well.

Co-authored-by: yutaro-sakamoto <80912876+yutaro-sakamoto@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot
このリポジトリではlibcobj/ディレクトリがgradleプロジェクトなのでそれを踏まえて修正できる?

You're absolutely right! I missed the create-release.yml workflow which also uses Gradle for publishing packages. I've now updated it to include the gradle/gradle-build-action@v3 with proper caching configuration as well. The change ensures all workflows that use the libcobj/ Gradle project now benefit from Gradle caching. See commit 77527af.

Copilot finished work on behalf of yutaro-sakamoto August 29, 2025 03:04
@yutaro-sakamoto
Copy link
Contributor

@copilot
Use gradle/actions/setup-gradle instead.
I think gradle/gradle-build-action is deprecated

…up-gradle

Co-authored-by: yutaro-sakamoto <80912876+yutaro-sakamoto@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot
Use gradle/actions/setup-gradle instead.
I think gradle/gradle-build-action is deprecated

You're absolutely right! I've updated all five workflows to use gradle/actions/setup-gradle@v3 instead of the deprecated gradle/gradle-build-action@v3. The change maintains the same caching functionality while using the recommended action. See commit adbbf7d.

Copilot AI changed the title Enable Gradle cache in GitHub Actions workflows Enable Gradle cache in GitHub Actions workflows using gradle/actions/setup-gradle Aug 29, 2025
Copilot finished work on behalf of yutaro-sakamoto August 29, 2025 05:10
@yutaro-sakamoto yutaro-sakamoto marked this pull request as ready for review August 29, 2025 06:25
Copilot AI review requested due to automatic review settings August 29, 2025 06:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables Gradle caching in GitHub Actions workflows to improve build performance by adding the gradle/actions/setup-gradle@v3 action to five workflows that use Gradle. This will cache Gradle dependencies, wrapper, and build cache between workflow runs.

  • Added Gradle setup step with caching to five GitHub Actions workflows
  • Replaced deprecated gradle/gradle-build-action with the recommended approach
  • Configured to use project's Gradle wrapper version for consistency

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/workflows/windows-build.yml Added Gradle setup for shadowJar build caching
.github/workflows/update-github-pages.yml Added Gradle setup for Javadoc generation caching
.github/workflows/static-analysis.yml Added Gradle setup for SpotBugs and PMD task caching
.github/workflows/javadoc.yml Added Gradle setup for Javadoc generation caching
.github/workflows/create-release.yml Replaced deprecated gradle-build-action with setup-gradle and direct command execution

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@yutaro-sakamoto
Copy link
Contributor

@copilot

gradleのキャッシュによる高速化は.github/workflows/build.ymlと.github/workflows/windows-build.yml に対してのみ適用するように変更して

Co-authored-by: yutaro-sakamoto <80912876+yutaro-sakamoto@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 2, 2025

@copilot

gradleのキャッシュによる高速化は.github/workflows/build.ymlと.github/workflows/windows-build.yml に対してのみ適用するように変更して

I've updated the workflows to limit Gradle caching to only windows-build.yml as requested. The gradle/actions/setup-gradle has been removed from static-analysis.yml, javadoc.yml, update-github-pages.yml, and create-release.yml.

Note: build.yml was not modified since it doesn't currently use any Gradle commands. Only windows-build.yml now has Gradle caching enabled. See commit 8647778.

Copilot AI changed the title Enable Gradle cache in GitHub Actions workflows using gradle/actions/setup-gradle Enable Gradle cache in windows-build.yml workflow using gradle/actions/setup-gradle Sep 2, 2025
Copilot finished work on behalf of yutaro-sakamoto September 2, 2025 01:22
@yutaro-sakamoto
Copy link
Contributor

@copilot
build.ymlはmakeコマンド実行時に暗黙にgradleを使っています。
build.ymlに対してもキャッシュによる高速化を施して

Co-authored-by: yutaro-sakamoto <80912876+yutaro-sakamoto@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 2, 2025

@copilot
build.ymlはmakeコマンド実行時に暗黙にgradleを使っています。
build.ymlに対してもキャッシュによる高速化を施して

You're absolutely right! I've added Gradle caching to build.yml since the make command implicitly calls ./gradlew shadowJar in the libcobj directory. Both build.yml and windows-build.yml now have Gradle cache optimization enabled. See commit 7e99233.

Copilot AI changed the title Enable Gradle cache in windows-build.yml workflow using gradle/actions/setup-gradle Enable Gradle cache in build.yml and windows-build.yml workflows using gradle/actions/setup-gradle Sep 2, 2025
Copilot finished work on behalf of yutaro-sakamoto September 2, 2025 01:26
@yutaro-sakamoto yutaro-sakamoto merged commit c6adbb1 into develop Sep 2, 2025
220 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable gradle cache in GitHub Actions

2 participants