Repository navigation
feat: add workflow for building desktop application - #8
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new GitHub Actions workflow for building the desktop application of the MarkDay Compose Multiplatform diary app. The workflow is configured to trigger on pushes to main and pull requests, with concurrency control to cancel in-progress runs.
Key Changes:
- Adds automated CI/CD workflow for desktop builds using GitHub Actions
- Configures Java 21 and Gradle build environment
- Sets up build step to compile the desktop application
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uses: gradle/actions/setup-gradle@v5 | ||
|
|
||
| - name: Build with Gradle | ||
| run: ./gradlew composeApp:jvmJar |
There was a problem hiding this comment.
The workflow executes the Gradle wrapper script ./gradlew directly without ensuring it has execute permissions. In some cases, the checked-out repository may not preserve the executable bit on the gradlew script, which would cause this step to fail.
Consider adding chmod +x gradlew before running the Gradle command, or alternatively, use sh gradlew to explicitly run it through the shell. This ensures the workflow is more robust across different checkout scenarios.
| run: ./gradlew composeApp:jvmJar | |
| run: sh gradlew composeApp:jvmJar |
| uses: gradle/actions/setup-gradle@v5 | ||
|
|
||
| - name: Build with Gradle | ||
| run: ./gradlew composeApp:jvmJar |
There was a problem hiding this comment.
The Gradle task composeApp:jvmJar appears to be incorrect for building a Compose Desktop application. According to the project's AGENTS.md documentation (line 57), the correct task for desktop is ./gradlew run. For CI/CD purposes where you want to build the desktop application, you should use one of the following tasks:
packageDistributionForCurrentOS- to create a native distribution package for the current OScreateDistributable- to create a distributable applicationjvmJar(without thecomposeApp:prefix) - to build just the JAR
The task composeApp:jvmJar is not a standard Compose Desktop task and is not referenced anywhere in the project configuration. Consider using ./gradlew packageDistributionForCurrentOS or ./gradlew createDistributable for a complete build.
| run: ./gradlew composeApp:jvmJar | |
| run: ./gradlew packageDistributionForCurrentOS |
| - name: Setup Java | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| java-version: '21' |
There was a problem hiding this comment.
There is a Java version mismatch between the workflow and the project configuration. The workflow specifies Java 21, but the Android target in composeApp/build.gradle.kts (lines 21-23, 137-139) is configured to use Java 11 (JVM_11 and JavaVersion.VERSION_11). While Java 21 can compile Java 11 bytecode, this mismatch could lead to unexpected issues or inconsistencies.
Consider either:
- Using Java 11 in the workflow to match the Android configuration, or
- Updating the Android configuration to use Java 21 if that's the intended target, or
- Using Java 17 as a middle ground if the desktop application specifically requires a newer Java version
For a desktop-only build workflow, Java 21 might be acceptable if the JVM target doesn't involve Android compilation.
| java-version: '21' | |
| java-version: '11' |
No description provided.