From 1356a9ed99a552fc18a66aee1413853648498e59 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 12:16:11 +0500 Subject: [PATCH 01/35] Update ci.yml --- .github/workflows/ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1bf07c..56df093 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,3 +39,20 @@ jobs: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Deploy to server : + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.DEPLOY_SSH_KEY }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest + From 4476cce1d083276befee552c6ccdb929c9f71170 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 12:28:34 +0500 Subject: [PATCH 02/35] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56df093..5aabed9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: host: ${{ secrets.DEPLOY_HOST }} username: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_SSH_KEY }} + port: ${{ secrets.DEPLOY_PORT }} script: | docker pull tayyab001/githubaction:latest docker stop myapp || true From 179807b53eb7d3d01c07ce2cc978b42aaf34b5ca Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 12:33:48 +0500 Subject: [PATCH 03/35] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5aabed9..b3bc29a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: with: host: ${{ secrets.DEPLOY_HOST }} username: ${{ secrets.DEPLOY_USER }} - key: ${{ secrets.DEPLOY_SSH_KEY }} + password: ${{ secrets.DEPLOY_PASSWORD }} port: ${{ secrets.DEPLOY_PORT }} script: | docker pull tayyab001/githubaction:latest From 7613f75bbe339ecc04c0c2bfe117b5b367f76eec Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 12:37:21 +0500 Subject: [PATCH 04/35] Update ci.yml --- .github/workflows/ci.yml | 58 +++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3bc29a..277e4c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,30 +1,23 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - name: Java CI with Gradle on: push: - branches: [ main ] + branches: [ main ] pull_request: branches: [ main ] jobs: build-java: - runs-on: ubuntu-latest - #strategy: - #matrix: - # os: [ubuntu-latest, Windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: - java-version: 1.8 + java-version: 17 + distribution: temurin - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -35,25 +28,24 @@ jobs: - name: Build and Push Docker Image uses: mr-smithers-excellent/docker-build-push@v4 with: - image: tayyab001/githubaction - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Deploy to server : + image: tayyab001/githubaction + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Deploy to server uses: appleboy/ssh-action@v1.0.3 with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latest - + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest From 16e8cde8ee5ad752fd0d82d15d91b741a50b3299 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 12:38:53 +0500 Subject: [PATCH 05/35] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 277e4c3..1a4de7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - name: Set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@v1 with: java-version: 17 distribution: temurin From 7ba202218ddc3c3c3874eade8ef6787cfb045428 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 12:42:26 +0500 Subject: [PATCH 06/35] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a4de7f..edbfc2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 17 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 17 + java-version: 11 distribution: temurin - name: Grant execute permission for gradlew From 78251a47ca7294c8086c10016e002632f8a6ec36 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 13:03:59 +0500 Subject: [PATCH 07/35] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edbfc2c..0e8e84c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: uses: mr-smithers-excellent/docker-build-push@v4 with: image: tayyab001/githubaction + tag: latest registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} From 115dc30b40913ab05ceff1e862281afded7a1626 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 13:36:40 +0500 Subject: [PATCH 08/35] Update ci.yml --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e8e84c..a3d099b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,17 @@ jobs: - name: Building with Gradle run: ./gradlew build + + - name: SonarQube Analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: | + ./gradlew sonar \ + -Dsonar.projectKey=my-java-app \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.qualitygate.wait=true - name: Build and Push Docker Image uses: mr-smithers-excellent/docker-build-push@v4 From 26cd6cb0e075bddce805d8cb3a162b96f0480cce Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 13:58:01 +0500 Subject: [PATCH 09/35] Update build.gradle --- build.gradle | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build.gradle b/build.gradle index 06ee087..eaca02f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java' id 'org.springframework.boot' version '2.2.2.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' + id 'org.sonarqube' version '4.4.1.3373' + id 'jacoco' } group 'com.example' @@ -18,3 +20,21 @@ dependencies { compile group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '5.2' testCompile group: 'junit', name: 'junit', version: '4.12' } +sonarqube { + properties { + property 'sonar.projectKey', 'my-java-app' + property 'sonar.projectName', 'My Java App' + property 'sonar.java.source', '1.8' + property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/jacoco/test/jacocoTestReport.xml' + } +} + +jacocoTestReport { + reports { + xml.required = true + } +} + +test { + finalizedBy jacocoTestReport +} From daf47df7a26a304963ab76b258a690a400bcd368 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 14:02:58 +0500 Subject: [PATCH 10/35] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eaca02f..0ab5158 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ sonarqube { jacocoTestReport { reports { - xml.required = true + xml.enabled = true } } From ca113d1168a580160a5701c810f58b5e3dfbff1f Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 14:05:50 +0500 Subject: [PATCH 11/35] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0ab5158..e41679c 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '2.2.2.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' - id 'org.sonarqube' version '4.4.1.3373' + id 'org.sonarqube' version '3.5.0.2730' id 'jacoco' } From 083c979616b5cf52c3d05925b7670756f88648bf Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 14:10:25 +0500 Subject: [PATCH 12/35] Update ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3d099b..b4b1cff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 distribution: temurin - name: Grant execute permission for gradlew From 2de922d2dbe61236a1b053647b909d06e321bdf6 Mon Sep 17 00:00:00 2001 From: Muhammad Tayyab Date: Wed, 25 Mar 2026 15:36:26 +0500 Subject: [PATCH 13/35] upgrade gradle to 7.6.4 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6ce793f..3994438 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From f6459fedc5d0d0b310f8cbeef3b2078764b23e45 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 15:39:47 +0500 Subject: [PATCH 14/35] Update build.gradle --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index e41679c..2eebb3d 100644 --- a/build.gradle +++ b/build.gradle @@ -17,8 +17,8 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' - compile group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '5.2' - testCompile group: 'junit', name: 'junit', version: '4.12' + implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '5.2' + testImplementation group: 'junit', name: 'junit', version: '4.12' } sonarqube { properties { From 23ac7195c495cb090848e17e400249bd0c88ae2f Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 16:28:37 +0500 Subject: [PATCH 15/35] Update ci.yml --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4b1cff..8488b45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,43 @@ jobs: - name: Building with Gradle run: ./gradlew build + - name: Zip test reports + if: always() + run: zip -r test-reports.zip build/reports/ + + - name: upload test report + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-reports + path: test-reports.zip + + - name: send email with report + if: always() + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.MAIL_USERNAME }} + password: ${{ secrets.MAIL_PASSWORD }} + subject: "Build ${{ job.status }} - ${{ github.repository }} #${{ github.run_number }}" + to: amjadtayyab4@gmail.com + from: Github Actions + attachments: test-reports.zip + body: | + Build Status: ${{ job.status }} + + Repository : ${{ github.repository }} + Branch : ${{ github.ref_name }} + Commit : ${{ github.sha }} + Triggered by: ${{ github.actor }} + + SonarQube Report: + ${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app + + View full logs: + https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + - name: SonarQube Analysis env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 8c1c8ffac730b46c3e81761964135e7d02f63554 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 16:37:50 +0500 Subject: [PATCH 16/35] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8488b45..0cd2759 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: username: ${{ secrets.MAIL_USERNAME }} password: ${{ secrets.MAIL_PASSWORD }} subject: "Build ${{ job.status }} - ${{ github.repository }} #${{ github.run_number }}" - to: amjadtayyab4@gmail.com + to: muhammad.tayyab@khaleef.com from: Github Actions attachments: test-reports.zip body: | From 2cbe956c080c0253ce7e7b77d0fbec8d1c366ce8 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 16:41:06 +0500 Subject: [PATCH 17/35] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cd2759..0866df2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - name: Zip test reports if: always() - run: zip -r test-reports.zip build/reports/ + run: zip -r test-reports.zip build/reports/tests/ - name: upload test report if: always() From 248305d078f0f643f7cd36790f6147baf756c399 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 16:46:20 +0500 Subject: [PATCH 18/35] Update ci.yml --- .github/workflows/ci.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0866df2..f4fc4d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: name: test-reports path: test-reports.zip - - name: send email with report + - name: Send email with report if: always() uses: dawidd6/action-send-mail@v3 with: @@ -44,22 +44,20 @@ jobs: server_port: 465 username: ${{ secrets.MAIL_USERNAME }} password: ${{ secrets.MAIL_PASSWORD }} - subject: "Build ${{ job.status }} - ${{ github.repository }} #${{ github.run_number }}" - to: muhammad.tayyab@khaleef.com - from: Github Actions - attachments: test-reports.zip + subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" + to: ${{ secrets.MAIL_USERNAME }} + from: GitHub Actions body: | - Build Status: ${{ job.status }} - - Repository : ${{ github.repository }} - Branch : ${{ github.ref_name }} - Commit : ${{ github.sha }} - Triggered by: ${{ github.actor }} + Build Status : ${{ job.status }} + Repository : ${{ github.repository }} + Branch : ${{ github.ref_name }} + Commit : ${{ github.sha }} + Triggered by : ${{ github.actor }} SonarQube Report: ${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app - View full logs: + Full Logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - name: SonarQube Analysis From 57079401d01bb442d845ff7efe01efa535ad4f71 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 16:53:07 +0500 Subject: [PATCH 19/35] Update ci.yml --- .github/workflows/ci.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4fc4d1..8efca0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,18 @@ jobs: - name: Building with Gradle run: ./gradlew build + + - name: SonarQube Analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: | + ./gradlew sonar \ + -Dsonar.projectKey=my-java-app \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.qualitygate.wait=true + - name: Zip test reports if: always() run: zip -r test-reports.zip build/reports/tests/ @@ -45,7 +57,7 @@ jobs: username: ${{ secrets.MAIL_USERNAME }} password: ${{ secrets.MAIL_PASSWORD }} subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" - to: ${{ secrets.MAIL_USERNAME }} + to: muhammad.tayyab@khaleef.com from: GitHub Actions body: | Build Status : ${{ job.status }} @@ -60,16 +72,6 @@ jobs: Full Logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - - name: SonarQube Analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: | - ./gradlew sonar \ - -Dsonar.projectKey=my-java-app \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true - name: Build and Push Docker Image uses: mr-smithers-excellent/docker-build-push@v4 From d48d2952a205b35587e88f55b0ebdf5591a09ab6 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 17:10:33 +0500 Subject: [PATCH 20/35] Update ci.yml --- .github/workflows/ci.yml | 81 +++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8efca0a..774a11b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up JDK 17 uses: actions/setup-java@v4 @@ -24,9 +26,9 @@ jobs: - name: Building with Gradle run: ./gradlew build - - + - name: SonarQube Analysis + timeout-minutes: 3 # stops waiting after 3 minutes instead of hanging forever env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} @@ -35,19 +37,34 @@ jobs: -Dsonar.projectKey=my-java-app \ -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true - + -Dsonar.qualitygate.wait=true \ + -Dsonar.qualitygate.timeout=120 + - name: Zip test reports if: always() - run: zip -r test-reports.zip build/reports/tests/ + run: | + zip -r test-reports.zip \ + build/reports/tests/ \ + build/reports/jacoco/ - - name: upload test report + - name: Upload test report artifact if: always() uses: actions/upload-artifact@v4 with: name: test-reports path: test-reports.zip - + + - name: Read test results + if: always() + id: test-results + run: | + TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + echo "tests=$TESTS" >> $GITHUB_OUTPUT + echo "failures=$FAILURES" >> $GITHUB_OUTPUT + echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + - name: Send email with report if: always() uses: dawidd6/action-send-mail@v3 @@ -59,19 +76,30 @@ jobs: subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" to: muhammad.tayyab@khaleef.com from: GitHub Actions + convert_markdown: true # renders the body as HTML email body: | - Build Status : ${{ job.status }} - Repository : ${{ github.repository }} - Branch : ${{ github.ref_name }} - Commit : ${{ github.sha }} - Triggered by : ${{ github.actor }} + ## Build Report + + | Field | Value | + |-------------|-------| + | Status | ${{ job.status }} | + | Repository | ${{ github.repository }} | + | Branch | ${{ github.ref_name }} | + | Commit | ${{ github.sha }} | + | Triggered by| ${{ github.actor }} | + | Build No | #${{ github.run_number }} | - SonarQube Report: - ${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app + ## Test Results - Full Logs: - https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - + | Total Tests | Failures | Skipped | + |------------|----------|---------| + | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | + + ## Links + + - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - name: Build and Push Docker Image uses: mr-smithers-excellent/docker-build-push@v4 @@ -82,19 +110,4 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Deploy to server - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latest + - name: Dep From a116a43d034fb3fbe8fb9ccc96a9b49ed8ed1be5 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 17:12:24 +0500 Subject: [PATCH 21/35] Update ci.yml --- .github/workflows/ci.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 774a11b..ef5594b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: run: ./gradlew build - name: SonarQube Analysis - timeout-minutes: 3 # stops waiting after 3 minutes instead of hanging forever + timeout-minutes: 3 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} @@ -76,7 +76,7 @@ jobs: subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" to: muhammad.tayyab@khaleef.com from: GitHub Actions - convert_markdown: true # renders the body as HTML email + convert_markdown: true body: | ## Build Report @@ -110,4 +110,19 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Dep + - name: Deploy to server + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest From a37da1503d2f35dc47ffc624c77db594fe519163 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 17:54:15 +0500 Subject: [PATCH 22/35] Update ci.yml --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef5594b..22ba77f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: run: ./gradlew build - name: SonarQube Analysis - timeout-minutes: 3 + timeout-minutes: 5 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} @@ -40,6 +40,22 @@ jobs: -Dsonar.qualitygate.wait=true \ -Dsonar.qualitygate.timeout=120 + - name: Generate SonarQube HTML Report + if: always() + run: | + # Use the latest stable version 5.0.2 + curl -L -o sonar-report-tool.jar https://github.com + + # Execute standalone report generation + java -jar sonar-report-tool.jar \ + -t ${{ secrets.SONAR_TOKEN }} \ + -s ${{ secrets.SONAR_HOST_URL }} \ + -p my-java-app \ + -o . + + # Consistent naming for the attachment + mv my-java-app-*.html sonarqube-report.html + - name: Zip test reports if: always() run: | @@ -47,13 +63,6 @@ jobs: build/reports/tests/ \ build/reports/jacoco/ - - name: Upload test report artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-reports - path: test-reports.zip - - name: Read test results if: always() id: test-results @@ -77,31 +86,34 @@ jobs: to: muhammad.tayyab@khaleef.com from: GitHub Actions convert_markdown: true + # Corrected comma-separated syntax for multiple files + attachments: sonarqube-report.html,test-reports.zip body: | ## Build Report + | Field | Value | |-------------|-------| | Status | ${{ job.status }} | | Repository | ${{ github.repository }} | | Branch | ${{ github.ref_name }} | - | Commit | ${{ github.sha }} | - | Triggered by| ${{ github.actor }} | | Build No | #${{ github.run_number }} | ## Test Results + | Total Tests | Failures | Skipped | |------------|----------|---------| | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | - ## Links - - - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + ## SonarQube & Links + + - **Reports Attached:** Check `sonarqube-report.html` and `test-reports.zip`. + - [SonarQube Dashboard](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + - [Full Build Logs](https://github.com{{ github.repository }}/actions/runs/${{ github.run_id }}) - name: Build and Push Docker Image + if: success() uses: mr-smithers-excellent/docker-build-push@v4 with: image: tayyab001/githubaction @@ -111,6 +123,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Deploy to server + if: success() uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.DEPLOY_HOST }} From 3d88141b638f13bcfc793860e824efbb3e830226 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 17:58:43 +0500 Subject: [PATCH 23/35] Update ci.yml --- .github/workflows/ci.yml | 58 +++++++--------------------------------- 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22ba77f..d4583d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,31 +37,27 @@ jobs: -Dsonar.projectKey=my-java-app \ -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true \ - -Dsonar.qualitygate.timeout=120 + -Dsonar.qualitygate.wait=true - name: Generate SonarQube HTML Report if: always() run: | - # Use the latest stable version 5.0.2 - curl -L -o sonar-report-tool.jar https://github.com + # Download with -L to follow GitHub redirects + curl -f -L -o sonar-report-tool.jar https://github.com - # Execute standalone report generation + # Execute report generation java -jar sonar-report-tool.jar \ -t ${{ secrets.SONAR_TOKEN }} \ -s ${{ secrets.SONAR_HOST_URL }} \ -p my-java-app \ -o . - # Consistent naming for the attachment mv my-java-app-*.html sonarqube-report.html - name: Zip test reports if: always() run: | - zip -r test-reports.zip \ - build/reports/tests/ \ - build/reports/jacoco/ + zip -r test-reports.zip build/reports/tests/ build/reports/jacoco/ - name: Read test results if: always() @@ -82,35 +78,17 @@ jobs: server_port: 465 username: ${{ secrets.MAIL_USERNAME }} password: ${{ secrets.MAIL_PASSWORD }} - subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" + subject: "Build ${{ job.status }} — #${{ github.run_number }}" to: muhammad.tayyab@khaleef.com from: GitHub Actions convert_markdown: true - # Corrected comma-separated syntax for multiple files attachments: sonarqube-report.html,test-reports.zip body: | ## Build Report + Status: ${{ job.status }} + Tests: ${{ steps.test-results.outputs.tests }} | Failures: ${{ steps.test-results.outputs.failures }} - - | Field | Value | - |-------------|-------| - | Status | ${{ job.status }} | - | Repository | ${{ github.repository }} | - | Branch | ${{ github.ref_name }} | - | Build No | #${{ github.run_number }} | - - ## Test Results - - - | Total Tests | Failures | Skipped | - |------------|----------|---------| - | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | - - ## SonarQube & Links - - - **Reports Attached:** Check `sonarqube-report.html` and `test-reports.zip`. - - [SonarQube Dashboard](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - - [Full Build Logs](https://github.com{{ github.repository }}/actions/runs/${{ github.run_id }}) + Please find the attached SonarQube HTML report and Test results. - name: Build and Push Docker Image if: success() @@ -121,21 +99,3 @@ jobs: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Deploy to server - if: success() - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latest From 580df8562dbaa81745922b814687ebcbc37e46bc Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 18:01:52 +0500 Subject: [PATCH 24/35] Update ci.yml --- .github/workflows/ci.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4583d3..e9ffb94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,16 +42,24 @@ jobs: - name: Generate SonarQube HTML Report if: always() run: | - # Download with -L to follow GitHub redirects - curl -f -L -o sonar-report-tool.jar https://github.com + # Download using -L (follow redirects) and -o (output filename) + # Using version 5.0.2 which is the latest stable release + curl -L -o sonar-cnes-report.jar https://github.com - # Execute report generation - java -jar sonar-report-tool.jar \ + # Verify the file is actually a JAR (ZIP) and not an HTML error page + if ! zip -T sonar-cnes-report.jar; then + echo "Downloaded file is corrupt or not a valid JAR." + exit 1 + fi + + # Run report generation + java -jar sonar-cnes-report.jar \ -t ${{ secrets.SONAR_TOKEN }} \ -s ${{ secrets.SONAR_HOST_URL }} \ -p my-java-app \ -o . + # Clean up naming for the email attachment mv my-java-app-*.html sonarqube-report.html - name: Zip test reports @@ -85,10 +93,10 @@ jobs: attachments: sonarqube-report.html,test-reports.zip body: | ## Build Report - Status: ${{ job.status }} - Tests: ${{ steps.test-results.outputs.tests }} | Failures: ${{ steps.test-results.outputs.failures }} + **Status:** ${{ job.status }} + **Tests:** ${{ steps.test-results.outputs.tests }} | **Failures:** ${{ steps.test-results.outputs.failures }} - Please find the attached SonarQube HTML report and Test results. + Please find the attached SonarQube HTML report and Test results zip. - name: Build and Push Docker Image if: success() From aeaea28dd41c47e8278565333077a57d98f754f0 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 18:06:23 +0500 Subject: [PATCH 25/35] Update ci.yml --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9ffb94..ec6b20c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,16 +42,9 @@ jobs: - name: Generate SonarQube HTML Report if: always() run: | - # Download using -L (follow redirects) and -o (output filename) - # Using version 5.0.2 which is the latest stable release - curl -L -o sonar-cnes-report.jar https://github.com + # Wget handles GitHub redirects much better than curl + wget -O sonar-cnes-report.jar https://github.com - # Verify the file is actually a JAR (ZIP) and not an HTML error page - if ! zip -T sonar-cnes-report.jar; then - echo "Downloaded file is corrupt or not a valid JAR." - exit 1 - fi - # Run report generation java -jar sonar-cnes-report.jar \ -t ${{ secrets.SONAR_TOKEN }} \ @@ -59,14 +52,9 @@ jobs: -p my-java-app \ -o . - # Clean up naming for the email attachment + # Rename to a fixed name mv my-java-app-*.html sonarqube-report.html - - name: Zip test reports - if: always() - run: | - zip -r test-reports.zip build/reports/tests/ build/reports/jacoco/ - - name: Read test results if: always() id: test-results @@ -78,6 +66,15 @@ jobs: echo "failures=$FAILURES" >> $GITHUB_OUTPUT echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + - name: Zip All Reports + if: always() + run: | + # Zipping the HTML report avoids Gmail's security block on .html files + zip -r final-report.zip \ + sonarqube-report.html \ + build/reports/tests/ \ + build/reports/jacoco/ + - name: Send email with report if: always() uses: dawidd6/action-send-mail@v3 @@ -90,13 +87,18 @@ jobs: to: muhammad.tayyab@khaleef.com from: GitHub Actions convert_markdown: true - attachments: sonarqube-report.html,test-reports.zip + # Attach the ZIP containing everything + attachments: final-report.zip body: | - ## Build Report - **Status:** ${{ job.status }} - **Tests:** ${{ steps.test-results.outputs.tests }} | **Failures:** ${{ steps.test-results.outputs.failures }} - - Please find the attached SonarQube HTML report and Test results zip. + ## Build Report Summary + + - **Status:** ${{ job.status }} + - **Total Tests:** ${{ steps.test-results.outputs.tests }} + - **Failures:** ${{ steps.test-results.outputs.failures }} + + **Note:** The SonarQube HTML report and unit test results are inside the attached `final-report.zip`. + + [View SonarQube Dashboard](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - name: Build and Push Docker Image if: success() @@ -107,3 +109,21 @@ jobs: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Deploy to server + if: success() + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest From b7794c9c74c8fb1ecf59b4f7ba5e1df0a929f7ef Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 18:10:45 +0500 Subject: [PATCH 26/35] Update ci.yml --- .github/workflows/ci.yml | 65 ++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec6b20c..4847cd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,21 +39,25 @@ jobs: -Dsonar.token=$SONAR_TOKEN \ -Dsonar.qualitygate.wait=true - - name: Generate SonarQube HTML Report + - name: Generate SonarQube Markdown Report if: always() run: | - # Wget handles GitHub redirects much better than curl - wget -O sonar-cnes-report.jar https://github.com + # Fixed Download: Using -L to follow redirects to the actual 42MB asset + curl -L -o sonar-cnes-report.jar https://github.com - # Run report generation + # Verify file size (should be ~42MB, not 555KB) + ls -lh sonar-cnes-report.jar + + # Generate Markdown (-m) instead of HTML to avoid Gmail security blocks java -jar sonar-cnes-report.jar \ -t ${{ secrets.SONAR_TOKEN }} \ -s ${{ secrets.SONAR_HOST_URL }} \ -p my-java-app \ + -m \ -o . - # Rename to a fixed name - mv my-java-app-*.html sonarqube-report.html + # Rename the markdown file for the email step + mv my-java-app-*.md sonar-report.md - name: Read test results if: always() @@ -61,19 +65,12 @@ jobs: run: | TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') echo "tests=$TESTS" >> $GITHUB_OUTPUT echo "failures=$FAILURES" >> $GITHUB_OUTPUT - echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT - - - name: Zip All Reports - if: always() - run: | - # Zipping the HTML report avoids Gmail's security block on .html files - zip -r final-report.zip \ - sonarqube-report.html \ - build/reports/tests/ \ - build/reports/jacoco/ + # Load the Sonar Markdown report content into an environment variable + echo "SONAR_SUMMARY<> $GITHUB_ENV + cat sonar-report.md >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV - name: Send email with report if: always() @@ -87,18 +84,18 @@ jobs: to: muhammad.tayyab@khaleef.com from: GitHub Actions convert_markdown: true - # Attach the ZIP containing everything - attachments: final-report.zip body: | - ## Build Report Summary + # Build & Sonar Report Summary - - **Status:** ${{ job.status }} - - **Total Tests:** ${{ steps.test-results.outputs.tests }} - - **Failures:** ${{ steps.test-results.outputs.failures }} + **Status:** ${{ job.status }} + **Total Tests:** ${{ steps.test-results.outputs.tests }} + **Failures:** ${{ steps.test-results.outputs.failures }} - **Note:** The SonarQube HTML report and unit test results are inside the attached `final-report.zip`. + --- + ${{ env.SONAR_SUMMARY }} + --- - [View SonarQube Dashboard](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + [View Full SonarQube Dashboard](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - name: Build and Push Docker Image if: success() @@ -109,21 +106,3 @@ jobs: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Deploy to server - if: success() - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latest From 977af4e69514e7d77bb7f0db8b72fe5aa7422499 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 18:41:05 +0500 Subject: [PATCH 27/35] Update ci.yml --- .github/workflows/ci.yml | 214 +++++++++++++++++++++------------------ 1 file changed, 117 insertions(+), 97 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4847cd3..a18c181 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,107 +2,127 @@ name: Java CI with Gradle on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build-java: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Building with Gradle - run: ./gradlew build - - - name: SonarQube Analysis - timeout-minutes: 5 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: | - ./gradlew sonar \ - -Dsonar.projectKey=my-java-app \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true - - - name: Generate SonarQube Markdown Report - if: always() - run: | - # Fixed Download: Using -L to follow redirects to the actual 42MB asset - curl -L -o sonar-cnes-report.jar https://github.com - - # Verify file size (should be ~42MB, not 555KB) - ls -lh sonar-cnes-report.jar - - # Generate Markdown (-m) instead of HTML to avoid Gmail security blocks - java -jar sonar-cnes-report.jar \ - -t ${{ secrets.SONAR_TOKEN }} \ - -s ${{ secrets.SONAR_HOST_URL }} \ - -p my-java-app \ - -m \ - -o . - - # Rename the markdown file for the email step - mv my-java-app-*.md sonar-report.md - - - name: Read test results - if: always() - id: test-results - run: | - TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - echo "tests=$TESTS" >> $GITHUB_OUTPUT - echo "failures=$FAILURES" >> $GITHUB_OUTPUT - # Load the Sonar Markdown report content into an environment variable - echo "SONAR_SUMMARY<> $GITHUB_ENV - cat sonar-report.md >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Send email with report - if: always() - uses: dawidd6/action-send-mail@v3 - with: - server_address: smtp.gmail.com - server_port: 465 - username: ${{ secrets.MAIL_USERNAME }} - password: ${{ secrets.MAIL_PASSWORD }} - subject: "Build ${{ job.status }} — #${{ github.run_number }}" - to: muhammad.tayyab@khaleef.com - from: GitHub Actions - convert_markdown: true - body: | - # Build & Sonar Report Summary - - **Status:** ${{ job.status }} - **Total Tests:** ${{ steps.test-results.outputs.tests }} - **Failures:** ${{ steps.test-results.outputs.failures }} - - --- - ${{ env.SONAR_SUMMARY }} - --- - - [View Full SonarQube Dashboard](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - - - name: Build and Push Docker Image - if: success() - uses: mr-smithers-excellent/docker-build-push@v4 - with: - image: tayyab001/githubaction - tag: latest - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Building with Gradle + run: ./gradlew build + + - name: SonarQube Analysis + timeout-minutes: 3 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: | + ./gradlew sonar \ + -Dsonar.projectKey=my-java-app \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.qualitygate.wait=true \ + -Dsonar.qualitygate.timeout=120 + + - name: Zip test reports + if: always() + run: | + zip -r test-reports.zip \ + build/reports/tests/ \ + build/reports/jacoco/ + + - name: Upload test report artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-reports + path: test-reports.zip + + - name: Read test results + if: always() + id: test-results + run: | + TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + echo "tests=$TESTS" >> $GITHUB_OUTPUT + echo "failures=$FAILURES" >> $GITHUB_OUTPUT + echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + + - name: Send email with report + if: always() + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.MAIL_USERNAME }} + password: ${{ secrets.MAIL_PASSWORD }} + subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" + to: muhammad.tayyab@khaleef.com + from: GitHub Actions + convert_markdown: true + body: | + ## Build Report + + | Field | Value | + |---------------|-------| + | Status | ${{ job.status }} | + | Repository | ${{ github.repository }} | + | Branch | ${{ github.ref_name }} | + | Commit | ${{ github.sha }} | + | Triggered by | ${{ github.actor }} | + | Build No | #${{ github.run_number }} | + + ## Test Results + + | Total Tests | Failures | Skipped | + |-------------|----------|---------| + | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | + + ## Links + + - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + - name: Build and Push Docker Image + uses: mr-smithers-excellent/docker-build-push@v4 + with: + image: tayyab001/githubaction + tag: latest + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Deploy to server + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest From 9b9b4c45ada8807d9a86fa2dd161879e0ae5ef6b Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 18:45:58 +0500 Subject: [PATCH 28/35] Update ci.yml --- .github/workflows/ci.yml | 234 +++++++++++++++++++-------------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a18c181..ef5594b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,127 +2,127 @@ name: Java CI with Gradle on: push: - branches: [main] + branches: [ main ] pull_request: - branches: [main] + branches: [ main ] jobs: build-java: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Building with Gradle - run: ./gradlew build - - - name: SonarQube Analysis - timeout-minutes: 3 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: | - ./gradlew sonar \ - -Dsonar.projectKey=my-java-app \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true \ - -Dsonar.qualitygate.timeout=120 - - - name: Zip test reports - if: always() - run: | - zip -r test-reports.zip \ - build/reports/tests/ \ - build/reports/jacoco/ - - - name: Upload test report artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-reports - path: test-reports.zip - - - name: Read test results - if: always() - id: test-results - run: | - TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - echo "tests=$TESTS" >> $GITHUB_OUTPUT - echo "failures=$FAILURES" >> $GITHUB_OUTPUT - echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT - - - name: Send email with report - if: always() - uses: dawidd6/action-send-mail@v3 - with: - server_address: smtp.gmail.com - server_port: 465 - username: ${{ secrets.MAIL_USERNAME }} - password: ${{ secrets.MAIL_PASSWORD }} - subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" - to: muhammad.tayyab@khaleef.com - from: GitHub Actions - convert_markdown: true - body: | - ## Build Report - - | Field | Value | - |---------------|-------| - | Status | ${{ job.status }} | - | Repository | ${{ github.repository }} | - | Branch | ${{ github.ref_name }} | - | Commit | ${{ github.sha }} | - | Triggered by | ${{ github.actor }} | - | Build No | #${{ github.run_number }} | - - ## Test Results - - | Total Tests | Failures | Skipped | - |-------------|----------|---------| - | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | - - ## Links - - - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - - name: Build and Push Docker Image - uses: mr-smithers-excellent/docker-build-push@v4 - with: - image: tayyab001/githubaction - tag: latest - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Deploy to server - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latest + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Building with Gradle + run: ./gradlew build + + - name: SonarQube Analysis + timeout-minutes: 3 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: | + ./gradlew sonar \ + -Dsonar.projectKey=my-java-app \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.qualitygate.wait=true \ + -Dsonar.qualitygate.timeout=120 + + - name: Zip test reports + if: always() + run: | + zip -r test-reports.zip \ + build/reports/tests/ \ + build/reports/jacoco/ + + - name: Upload test report artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-reports + path: test-reports.zip + + - name: Read test results + if: always() + id: test-results + run: | + TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + echo "tests=$TESTS" >> $GITHUB_OUTPUT + echo "failures=$FAILURES" >> $GITHUB_OUTPUT + echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + + - name: Send email with report + if: always() + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.MAIL_USERNAME }} + password: ${{ secrets.MAIL_PASSWORD }} + subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" + to: muhammad.tayyab@khaleef.com + from: GitHub Actions + convert_markdown: true + body: | + ## Build Report + + | Field | Value | + |-------------|-------| + | Status | ${{ job.status }} | + | Repository | ${{ github.repository }} | + | Branch | ${{ github.ref_name }} | + | Commit | ${{ github.sha }} | + | Triggered by| ${{ github.actor }} | + | Build No | #${{ github.run_number }} | + + ## Test Results + + | Total Tests | Failures | Skipped | + |------------|----------|---------| + | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | + + ## Links + + - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + - name: Build and Push Docker Image + uses: mr-smithers-excellent/docker-build-push@v4 + with: + image: tayyab001/githubaction + tag: latest + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Deploy to server + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest From 206b3f4e243389462ffd49cbd4dfa1ab46550832 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 19:03:27 +0500 Subject: [PATCH 29/35] Update ci.yml --- .github/workflows/ci.yml | 127 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef5594b..0a2cdf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,133 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Deploy to server + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latestname: Java CI with Gradle + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build-java: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Building with Gradle + run: ./gradlew build + + - name: SonarQube Analysis + timeout-minutes: 3 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: | + ./gradlew sonar \ + -Dsonar.projectKey=my-java-app \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.qualitygate.wait=true \ + -Dsonar.qualitygate.timeout=120 + + - name: Zip test reports + if: always() + run: | + zip -r test-reports.zip \ + build/reports/tests/ \ + build/reports/jacoco/ + + - name: Upload test report artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-reports + path: test-reports.zip + + - name: Read test results + if: always() + id: test-results + run: | + TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + echo "tests=$TESTS" >> $GITHUB_OUTPUT + echo "failures=$FAILURES" >> $GITHUB_OUTPUT + echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + + - name: Send email with report + if: always() + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.MAIL_USERNAME }} + password: ${{ secrets.MAIL_PASSWORD }} + subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" + to: muhammad.tayyab@khaleef.com + from: GitHub Actions + convert_markdown: true + body: | + ## Build Report + + | Field | Value | + |-------------|-------| + | Status | ${{ job.status }} | + | Repository | ${{ github.repository }} | + | Branch | ${{ github.ref_name }} | + | Commit | ${{ github.sha }} | + | Triggered by| ${{ github.actor }} | + | Build No | #${{ github.run_number }} | + + ## Test Results + + | Total Tests | Failures | Skipped | + |------------|----------|---------| + | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | + + ## Links + + - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + - name: Build and Push Docker Image + uses: mr-smithers-excellent/docker-build-push@v4 + with: + image: tayyab001/githubaction + tag: latest + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Deploy to server uses: appleboy/ssh-action@v1.0.3 with: From 51ed9e9d367d112a803cbb7f6d4d4fb397bc8b4d Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 19:11:51 +0500 Subject: [PATCH 30/35] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a2cdf7..7b8df9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,6 @@ jobs: run: ./gradlew build - name: SonarQube Analysis - timeout-minutes: 3 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From 1e8de1dd41a408a8a2be97c7642ffc5d9eb33e5e Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Wed, 25 Mar 2026 19:13:45 +0500 Subject: [PATCH 31/35] Update ci.yml --- .github/workflows/ci.yml | 360 +++++++++++++-------------------------- 1 file changed, 117 insertions(+), 243 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b8df9b..a18c181 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,253 +2,127 @@ name: Java CI with Gradle on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build-java: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Building with Gradle - run: ./gradlew build - - - name: SonarQube Analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: | - ./gradlew sonar \ - -Dsonar.projectKey=my-java-app \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true \ - -Dsonar.qualitygate.timeout=120 - - - name: Zip test reports - if: always() - run: | - zip -r test-reports.zip \ - build/reports/tests/ \ - build/reports/jacoco/ - - - name: Upload test report artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-reports - path: test-reports.zip - - - name: Read test results - if: always() - id: test-results - run: | - TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - echo "tests=$TESTS" >> $GITHUB_OUTPUT - echo "failures=$FAILURES" >> $GITHUB_OUTPUT - echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT - - - name: Send email with report - if: always() - uses: dawidd6/action-send-mail@v3 - with: - server_address: smtp.gmail.com - server_port: 465 - username: ${{ secrets.MAIL_USERNAME }} - password: ${{ secrets.MAIL_PASSWORD }} - subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" - to: muhammad.tayyab@khaleef.com - from: GitHub Actions - convert_markdown: true - body: | - ## Build Report - - | Field | Value | - |-------------|-------| - | Status | ${{ job.status }} | - | Repository | ${{ github.repository }} | - | Branch | ${{ github.ref_name }} | - | Commit | ${{ github.sha }} | - | Triggered by| ${{ github.actor }} | - | Build No | #${{ github.run_number }} | - - ## Test Results - - | Total Tests | Failures | Skipped | - |------------|----------|---------| - | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | - - ## Links - - - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - - name: Build and Push Docker Image - uses: mr-smithers-excellent/docker-build-push@v4 - with: - image: tayyab001/githubaction - tag: latest - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Deploy to server - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latestname: Java CI with Gradle - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build-java: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Building with Gradle - run: ./gradlew build - - - name: SonarQube Analysis - timeout-minutes: 3 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: | - ./gradlew sonar \ - -Dsonar.projectKey=my-java-app \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true \ - -Dsonar.qualitygate.timeout=120 - - - name: Zip test reports - if: always() - run: | - zip -r test-reports.zip \ - build/reports/tests/ \ - build/reports/jacoco/ - - - name: Upload test report artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-reports - path: test-reports.zip - - - name: Read test results - if: always() - id: test-results - run: | - TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - echo "tests=$TESTS" >> $GITHUB_OUTPUT - echo "failures=$FAILURES" >> $GITHUB_OUTPUT - echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT - - - name: Send email with report - if: always() - uses: dawidd6/action-send-mail@v3 - with: - server_address: smtp.gmail.com - server_port: 465 - username: ${{ secrets.MAIL_USERNAME }} - password: ${{ secrets.MAIL_PASSWORD }} - subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" - to: muhammad.tayyab@khaleef.com - from: GitHub Actions - convert_markdown: true - body: | - ## Build Report - - | Field | Value | - |-------------|-------| - | Status | ${{ job.status }} | - | Repository | ${{ github.repository }} | - | Branch | ${{ github.ref_name }} | - | Commit | ${{ github.sha }} | - | Triggered by| ${{ github.actor }} | - | Build No | #${{ github.run_number }} | - - ## Test Results - - | Total Tests | Failures | Skipped | - |------------|----------|---------| - | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | - - ## Links - - - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - - name: Build and Push Docker Image - uses: mr-smithers-excellent/docker-build-push@v4 - with: - image: tayyab001/githubaction - tag: latest - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Deploy to server - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latest + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Building with Gradle + run: ./gradlew build + + - name: SonarQube Analysis + timeout-minutes: 3 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: | + ./gradlew sonar \ + -Dsonar.projectKey=my-java-app \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.qualitygate.wait=true \ + -Dsonar.qualitygate.timeout=120 + + - name: Zip test reports + if: always() + run: | + zip -r test-reports.zip \ + build/reports/tests/ \ + build/reports/jacoco/ + + - name: Upload test report artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-reports + path: test-reports.zip + + - name: Read test results + if: always() + id: test-results + run: | + TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + echo "tests=$TESTS" >> $GITHUB_OUTPUT + echo "failures=$FAILURES" >> $GITHUB_OUTPUT + echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + + - name: Send email with report + if: always() + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.MAIL_USERNAME }} + password: ${{ secrets.MAIL_PASSWORD }} + subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" + to: muhammad.tayyab@khaleef.com + from: GitHub Actions + convert_markdown: true + body: | + ## Build Report + + | Field | Value | + |---------------|-------| + | Status | ${{ job.status }} | + | Repository | ${{ github.repository }} | + | Branch | ${{ github.ref_name }} | + | Commit | ${{ github.sha }} | + | Triggered by | ${{ github.actor }} | + | Build No | #${{ github.run_number }} | + + ## Test Results + + | Total Tests | Failures | Skipped | + |-------------|----------|---------| + | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | + + ## Links + + - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + - name: Build and Push Docker Image + uses: mr-smithers-excellent/docker-build-push@v4 + with: + image: tayyab001/githubaction + tag: latest + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Deploy to server + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest From a1fcfb3e9ff604f4e6d698e67129ff125cc50b40 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Thu, 26 Mar 2026 09:40:35 +0500 Subject: [PATCH 32/35] Update ci.yml --- .github/workflows/ci.yml | 234 +++++++++++++++++++-------------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a18c181..ef5594b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,127 +2,127 @@ name: Java CI with Gradle on: push: - branches: [main] + branches: [ main ] pull_request: - branches: [main] + branches: [ main ] jobs: build-java: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Building with Gradle - run: ./gradlew build - - - name: SonarQube Analysis - timeout-minutes: 3 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: | - ./gradlew sonar \ - -Dsonar.projectKey=my-java-app \ - -Dsonar.host.url=$SONAR_HOST_URL \ - -Dsonar.token=$SONAR_TOKEN \ - -Dsonar.qualitygate.wait=true \ - -Dsonar.qualitygate.timeout=120 - - - name: Zip test reports - if: always() - run: | - zip -r test-reports.zip \ - build/reports/tests/ \ - build/reports/jacoco/ - - - name: Upload test report artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-reports - path: test-reports.zip - - - name: Read test results - if: always() - id: test-results - run: | - TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') - echo "tests=$TESTS" >> $GITHUB_OUTPUT - echo "failures=$FAILURES" >> $GITHUB_OUTPUT - echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT - - - name: Send email with report - if: always() - uses: dawidd6/action-send-mail@v3 - with: - server_address: smtp.gmail.com - server_port: 465 - username: ${{ secrets.MAIL_USERNAME }} - password: ${{ secrets.MAIL_PASSWORD }} - subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" - to: muhammad.tayyab@khaleef.com - from: GitHub Actions - convert_markdown: true - body: | - ## Build Report - - | Field | Value | - |---------------|-------| - | Status | ${{ job.status }} | - | Repository | ${{ github.repository }} | - | Branch | ${{ github.ref_name }} | - | Commit | ${{ github.sha }} | - | Triggered by | ${{ github.actor }} | - | Build No | #${{ github.run_number }} | - - ## Test Results - - | Total Tests | Failures | Skipped | - |-------------|----------|---------| - | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | - - ## Links - - - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) - - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - - name: Build and Push Docker Image - uses: mr-smithers-excellent/docker-build-push@v4 - with: - image: tayyab001/githubaction - tag: latest - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Deploy to server - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.DEPLOY_HOST }} - username: ${{ secrets.DEPLOY_USER }} - password: ${{ secrets.DEPLOY_PASSWORD }} - port: ${{ secrets.DEPLOY_PORT }} - script: | - docker pull tayyab001/githubaction:latest - docker stop myapp || true - docker rm myapp || true - docker run -d \ - --name myapp \ - --restart always \ - -p 8080:8080 \ - tayyab001/githubaction:latest + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Building with Gradle + run: ./gradlew build + + - name: SonarQube Analysis + timeout-minutes: 3 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + run: | + ./gradlew sonar \ + -Dsonar.projectKey=my-java-app \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.token=$SONAR_TOKEN \ + -Dsonar.qualitygate.wait=true \ + -Dsonar.qualitygate.timeout=120 + + - name: Zip test reports + if: always() + run: | + zip -r test-reports.zip \ + build/reports/tests/ \ + build/reports/jacoco/ + + - name: Upload test report artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-reports + path: test-reports.zip + + - name: Read test results + if: always() + id: test-results + run: | + TESTS=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "tests=" | grep -o 'tests="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + FAILURES=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "failures=" | grep -o 'failures="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + SKIPPED=$(find build/reports/tests/test -name "*.xml" | xargs grep -h "skipped=" | grep -o 'skipped="[0-9]*"' | grep -o '[0-9]*' | awk '{s+=$1} END {print s}') + echo "tests=$TESTS" >> $GITHUB_OUTPUT + echo "failures=$FAILURES" >> $GITHUB_OUTPUT + echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + + - name: Send email with report + if: always() + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.MAIL_USERNAME }} + password: ${{ secrets.MAIL_PASSWORD }} + subject: "Build ${{ job.status }} — ${{ github.repository }} #${{ github.run_number }}" + to: muhammad.tayyab@khaleef.com + from: GitHub Actions + convert_markdown: true + body: | + ## Build Report + + | Field | Value | + |-------------|-------| + | Status | ${{ job.status }} | + | Repository | ${{ github.repository }} | + | Branch | ${{ github.ref_name }} | + | Commit | ${{ github.sha }} | + | Triggered by| ${{ github.actor }} | + | Build No | #${{ github.run_number }} | + + ## Test Results + + | Total Tests | Failures | Skipped | + |------------|----------|---------| + | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | + + ## Links + + - [SonarQube Report](${{ secrets.SONAR_HOST_URL }}/dashboard?id=my-java-app) + - [Full Logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + - [Download Test Reports](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + - name: Build and Push Docker Image + uses: mr-smithers-excellent/docker-build-push@v4 + with: + image: tayyab001/githubaction + tag: latest + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Deploy to server + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + port: ${{ secrets.DEPLOY_PORT }} + script: | + docker pull tayyab001/githubaction:latest + docker stop myapp || true + docker rm myapp || true + docker run -d \ + --name myapp \ + --restart always \ + -p 8080:8080 \ + tayyab001/githubaction:latest From 892c9ca5856d37dcbc34476740479c70aee17c54 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Thu, 26 Mar 2026 09:52:33 +0500 Subject: [PATCH 33/35] Update ci.yml --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef5594b..08e340c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,24 @@ jobs: echo "tests=$TESTS" >> $GITHUB_OUTPUT echo "failures=$FAILURES" >> $GITHUB_OUTPUT echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT + + - name: Get SonarQube results + if: always() + run: | + curl -u ${{ secrets.SONAR_TOKEN }}: \ + "${{ secrets.SONAR_HOST_URL }}/api/measures/component?component=my-java-app&metricKeys=bugs,vulnerabilities,code_smells,coverage,duplicated_lines_density" \ + -o sonar-results.json + + BUGS=$(cat sonar-results.json | python3 -c "import sys,json; measures=json.load(sys.stdin)['component']['measures']; print(next(m['value'] for m in measures if m['metric']=='bugs'))") + VULNERABILITIES=$(cat sonar-results.json | python3 -c "import sys,json; measures=json.load(sys.stdin)['component']['measures']; print(next(m['value'] for m in measures if m['metric']=='vulnerabilities'))") + CODE_SMELLS=$(cat sonar-results.json | python3 -c "import sys,json; measures=json.load(sys.stdin)['component']['measures']; print(next(m['value'] for m in measures if m['metric']=='code_smells'))") + COVERAGE=$(cat sonar-results.json | python3 -c "import sys,json; measures=json.load(sys.stdin)['component']['measures']; print(next(m['value'] for m in measures if m['metric']=='coverage'))") + + echo "bugs=$BUGS" >> $GITHUB_OUTPUT + echo "vulnerabilities=$VULNERABILITIES" >> $GITHUB_OUTPUT + echo "code_smells=$CODE_SMELLS" >> $GITHUB_OUTPUT + echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + id: sonar-results - name: Send email with report if: always() @@ -94,6 +112,13 @@ jobs: | Total Tests | Failures | Skipped | |------------|----------|---------| | ${{ steps.test-results.outputs.tests }} | ${{ steps.test-results.outputs.failures }} | ${{ steps.test-results.outputs.skipped }} | + + | Metric | Value | + |----------------|-------| + | Bugs | ${{ steps.sonar-results.outputs.bugs }} | + | Vulnerabilities| ${{ steps.sonar-results.outputs.vulnerabilities }} | + | Code Smells | ${{ steps.sonar-results.outputs.code_smells }} | + | Coverage | ${{ steps.sonar-results.outputs.coverage }}% | ## Links From 255bd3c87d8597cbf21f1d947bdc15fe3da2b76e Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Thu, 26 Mar 2026 10:01:06 +0500 Subject: [PATCH 34/35] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08e340c..0520bfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,8 @@ jobs: curl -u ${{ secrets.SONAR_TOKEN }}: \ "${{ secrets.SONAR_HOST_URL }}/api/measures/component?component=my-java-app&metricKeys=bugs,vulnerabilities,code_smells,coverage,duplicated_lines_density" \ -o sonar-results.json - + cat sonar-results.json + BUGS=$(cat sonar-results.json | python3 -c "import sys,json; measures=json.load(sys.stdin)['component']['measures']; print(next(m['value'] for m in measures if m['metric']=='bugs'))") VULNERABILITIES=$(cat sonar-results.json | python3 -c "import sys,json; measures=json.load(sys.stdin)['component']['measures']; print(next(m['value'] for m in measures if m['metric']=='vulnerabilities'))") CODE_SMELLS=$(cat sonar-results.json | python3 -c "import sys,json; measures=json.load(sys.stdin)['component']['measures']; print(next(m['value'] for m in measures if m['metric']=='code_smells'))") From e179b009d3da5e8bf24b16d1c3e32d1f49114ae6 Mon Sep 17 00:00:00 2001 From: Ahmad_abdullah Date: Thu, 26 Mar 2026 10:09:52 +0500 Subject: [PATCH 35/35] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0520bfb..1d328f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT id: sonar-results - - name: Send email with report + - name: Send email with reports if: always() uses: dawidd6/action-send-mail@v3 with: