From 9fd50ad71fa0a0a11f6c2d44a7ebbb7b066c9a1a Mon Sep 17 00:00:00 2001 From: Niranjan Kumar Agri <45349200+niranjankagri@users.noreply.github.com> Date: Mon, 26 Oct 2026 16:27:32 +0530 Subject: [PATCH] Add reproducible Gradle build and application launch checks --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ README.md | 8 ++++++++ build.gradle | 10 ++++++---- 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 README.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..399b078 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Build and launch +on: + push: + branches: [master] + pull_request: + workflow_dispatch: +permissions: + contents: read +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true +jobs: + build: + name: Compile, package and launch (Java 8) + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6 + with: + distribution: temurin + java-version: '8' + - name: Build and run through Gradle + run: bash ./gradlew --no-daemon clean build run + - name: Launch the packaged application + run: java -jar build/libs/ExampleApp.jar diff --git a/README.md b/README.md new file mode 100644 index 0000000..d85ed77 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# ExampleApp + +A minimal Java console application built with the checked-in Gradle 5.2 wrapper and Java 8. + +Build and launch: `bash ./gradlew --no-daemon clean build run`. +Run the packaged application: `java -jar build/libs/ExampleApp.jar`. + +GitHub Actions checks compilation, packaging and both launch paths on pushes and pull requests. The existing JUnit method is an empty placeholder, so a successful build is not evidence of functional test coverage. diff --git a/build.gradle b/build.gradle index c32e114..9028756 100644 --- a/build.gradle +++ b/build.gradle @@ -15,9 +15,9 @@ plugins { } repositories { - // Use jcenter for resolving your dependencies. + // Resolve dependencies from Maven Central. // You can declare any Maven/Ivy/file repository here. - jcenter() + mavenCentral() } dependencies { @@ -33,11 +33,13 @@ test { } } +mainClassName = 'main.java.ExampleApp.Main' + jar { manifest { - attributes 'Main-Class': 'main.java.ExampleApp.Main' + attributes 'Main-Class': mainClassName } } // Define the main class for the application -mainClassName = 'ExampleApp.Main' +