From eb4d4eb710c3d75fa89babfb8bd3f0130d35906b Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Wed, 20 Aug 2025 21:53:54 +0200 Subject: [PATCH 01/15] updated sonar configs --- .github/workflows/main.yml | 2 +- sonar-project.properties | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d22381..5d8c2b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,7 +35,7 @@ jobs: - name: Setup Sonar Scanner uses: warchant/setup-sonar-scanner@v3 with: - version: 4.6.2.2472 + version: 5.0.2.4997 - name: Run Sonar Scanner env: diff --git a/sonar-project.properties b/sonar-project.properties index d261caa..a7808d9 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,6 +2,8 @@ sonar.organization=nuvla sonar.projectKey=nuvla-clojure-library sonar.projectName=nuvla-clojure-library sonar.sources=src,project.clj +sonar.clojure.file.suffixes=.clj,.cljc +sonar.lang.patterns.clj=**/*.clj,**/*.cljc sonar.tests=test sonar.clojure.sensors.timeout=3600 sonar.clojure.eastwood.enabled=true From 6aac10d4e1afefa04c7c5cad9cec2a9138cdeda4 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Wed, 20 Aug 2025 22:06:17 +0200 Subject: [PATCH 02/15] actions cache to v4 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d8c2b0..f8c0c54 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 0 - name: Cache local Maven repository - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} From 17d6648a425272d8dc4f40d073e6346890b9b206 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Wed, 20 Aug 2025 22:10:47 +0200 Subject: [PATCH 03/15] sonar creds --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8c0c54..518d7a6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: # provide GITHUB_TOKEN to get access to secrets.SONAR_TOKEN GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: sonar-scanner - -Dsonar.login=${{ secrets.SONAR_TOKEN }} + -Dsonar.token=${{ secrets.SONARQUBE_TOKEN}} -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} - name: Get list of tests From eec78c7def159c5a0a47fda297ce79d609367f8a Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Wed, 20 Aug 2025 22:22:33 +0200 Subject: [PATCH 04/15] install lein --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 518d7a6..db993ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,11 @@ jobs: distribution: 'zulu' java-version: '11' + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@12.5 + with: + lein: 2.11.2 + - name: Setup Sonar Scanner uses: warchant/setup-sonar-scanner@v3 with: From 1600f4e7023a5ac6d327d1056106d12bdc369e83 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Wed, 20 Aug 2025 22:24:38 +0200 Subject: [PATCH 05/15] fix formatting --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db993ee..019e6ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,10 +32,10 @@ jobs: distribution: 'zulu' java-version: '11' - - name: Install clojure tools - uses: DeLaGuardo/setup-clojure@12.5 - with: - lein: 2.11.2 + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@12.5 + with: + lein: 2.11.2 - name: Setup Sonar Scanner uses: warchant/setup-sonar-scanner@v3 From b12c8249748f830c1508d761997fad6009c9c71a Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Wed, 20 Aug 2025 22:51:10 +0200 Subject: [PATCH 06/15] debug --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 019e6ea..5b445cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,6 +50,11 @@ jobs: -Dsonar.token=${{ secrets.SONARQUBE_TOKEN}} -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} + - name: List test reports + run: | + pwd + ls -lR test-reports + - name: Get list of tests if: always() id: tests From 899e0922d630bc875108ed9514f1acb3ba42d40f Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Wed, 20 Aug 2025 22:59:55 +0200 Subject: [PATCH 07/15] debug --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5b445cf..6aa4c78 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,7 @@ jobs: env: # provide GITHUB_TOKEN to get access to secrets.SONAR_TOKEN GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: sonar-scanner + run: sonar-scanner -X -Dsonar.token=${{ secrets.SONARQUBE_TOKEN}} -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} From 2b0b216965a1b0c972cb54c1f87c153e2dd6c81f Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 09:37:25 +0200 Subject: [PATCH 08/15] jdk to 21 --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6aa4c78..510f35a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,11 +26,11 @@ jobs: ${{ runner.os }}-maven- - name: Cache local Maven repository - - name: Set up JDK 11 - uses: actions/setup-java@v2 + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: - distribution: 'zulu' - java-version: '11' + distribution: 'temurin' + java-version: '21' - name: Install clojure tools uses: DeLaGuardo/setup-clojure@12.5 From 8a224f69ab6a1d0f9130ec7dfd9b6608155263b0 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 10:20:26 +0200 Subject: [PATCH 09/15] debug: keep only cloverage --- sonar-project.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index a7808d9..4802a14 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,11 +6,11 @@ sonar.clojure.file.suffixes=.clj,.cljc sonar.lang.patterns.clj=**/*.clj,**/*.cljc sonar.tests=test sonar.clojure.sensors.timeout=3600 -sonar.clojure.eastwood.enabled=true -sonar.clojure.kibit.enabled=true -sonar.clojure.kondo.enabled=true -sonar.clojure.ancient.enabled=true -sonar.clojure.nvd.enabled=true +sonar.clojure.eastwood.enabled=false +sonar.clojure.kibit.enabled=false +sonar.clojure.kondo.enabled=false +sonar.clojure.ancient.enabled=false +sonar.clojure.nvd.enabled=false sonar.clojure.nvd.reportPath=target/nvd/dependency-check-report.json sonar.clojure.cloverage.enabled=true sonar.clojure.cloverage.reportPath=target/coverage/codecov.json From ae60d67caae8316e105a6a8d8334da4fd7ca4c1b Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 10:29:51 +0200 Subject: [PATCH 10/15] debug: update cache and checkout --- .github/workflows/main.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 510f35a..eb7a221 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: job-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: # Disabling shallow clone is recommended for improving relevancy of reporting for sonar fetch-depth: 0 @@ -21,7 +21,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-lein-${{ hashFiles('**/project.clj') }} restore-keys: | ${{ runner.os }}-maven- - name: Cache local Maven repository @@ -37,6 +37,16 @@ jobs: with: lein: 2.11.2 + # Ubuntu Repos on Azure fail often. Attempt to install before other + # long-running operations. + # xmllinter for tests checks + # jq for SonarQube Quality Gate check + - name: Install xmllinter and jq (for "Fail on failed tests") + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y libxml2-utils jq + - name: Setup Sonar Scanner uses: warchant/setup-sonar-scanner@v3 with: From a98301080a25fe8043f859dc8366b21c7c80ca72 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 10:36:25 +0200 Subject: [PATCH 11/15] debug: update cache --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eb7a221..7c16a37 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,8 +23,8 @@ jobs: path: ~/.m2/repository key: ${{ runner.os }}-lein-${{ hashFiles('**/project.clj') }} restore-keys: | - ${{ runner.os }}-maven- - - name: Cache local Maven repository + ${{ runner.os }}-lein- + - name: Cache local M2 repository - name: Set up JDK 21 uses: actions/setup-java@v4 From c7e2b6c355b47ee9fe86074139dfe52400614451 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 11:02:57 +0200 Subject: [PATCH 12/15] use setup sonar scanner v7 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c16a37..0c6f331 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: sudo apt-get install -y libxml2-utils jq - name: Setup Sonar Scanner - uses: warchant/setup-sonar-scanner@v3 + uses: warchant/setup-sonar-scanner@v7 with: version: 5.0.2.4997 From 8fab9694a2d29eecb8e83af40ed23c9ea7f1f280 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 15:49:44 +0200 Subject: [PATCH 13/15] do not AOT for tests, adjust test results output location --- .github/workflows/main.yml | 2 +- project.clj | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0c6f331..cd4c5ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,7 +70,7 @@ jobs: id: tests uses: Rishabh510/Path-lister-action@master with: - path: "test-reports" + path: "test-reports/xml" type: ".xml" - name: Fail on failed tests diff --git a/project.clj b/project.clj index e45af43..de23c22 100644 --- a/project.clj +++ b/project.clj @@ -60,10 +60,13 @@ :profiles {:provided {:dependencies [[org.clojure/clojure] [org.clojure/clojurescript]] } - :test {:aot :all + :test { + ;:aot :all :source-paths ["test/clj" "test/cljc"] :resource-paths ["dev-resources"] - :plugins [[lein-test-report-junit-xml "0.2.0"]] + :plugins [[org.clojars.konstan/lein-test-report-sonar "0.0.4"]] + :test-report-sonar {:output-dir "test-reports" + :emit-junit-xml true} :test-report-junit-xml {:output-dir "test-reports"}} :dev {:dependencies [[com.fasterxml.jackson.core/jackson-databind "2.15.2"] [clj-kondo "RELEASE"]]}} From 719a42a4c553ffb3f5213eb17abb32e7722b7294 Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 15:53:40 +0200 Subject: [PATCH 14/15] use SONARQUBE_TOKEN --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cd4c5ac..cb5498e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -102,7 +102,7 @@ jobs: with: scanMetadataReportFile: .scannerwork/report-task.txt env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - uses: s4u/maven-settings-action@v2.2.0 From 16596a3acae28347e44aaf8de5182c9dbe25216e Mon Sep 17 00:00:00 2001 From: Konstantin Skaburskas Date: Thu, 21 Aug 2025 16:54:35 +0200 Subject: [PATCH 15/15] push to clojars instead --- .github/workflows/main.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb5498e..3c6fe17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,11 @@ on: - master pull_request: workflow_dispatch: + inputs: + PUSH_CLOJARS: + description: 'Push test-jar to clojars' + required: true + type: boolean jobs: @@ -122,16 +127,15 @@ jobs: id: extract_branch - name: Build - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: lein do clean, jar, install - - name: Deploy + - name: Deploy to clojars + run: lein deploy clojars + if: ${{ inputs.PUSH_CLOJARS }} + shell: bash env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - run: lein deploy + CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }} + CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v1