From a4b3f5b775f827d0da20d2cf52851c1cabc2099f Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Thu, 30 Jul 2026 15:13:19 +0100 Subject: [PATCH 1/8] mesh-2925: fix sonar --- .github/workflows/merge-develop.yml | 20 ++++++-------------- .github/workflows/pull-request.yml | 23 +++++------------------ scripts/sonar_tests.py | 5 +++++ 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/.github/workflows/merge-develop.yml b/.github/workflows/merge-develop.yml index 2c27b01..38106b5 100644 --- a/.github/workflows/merge-develop.yml +++ b/.github/workflows/merge-develop.yml @@ -78,23 +78,15 @@ jobs: distribution: "corretto" java-version: "17" - - name: provision sonar-scanner - if: github.actor != 'dependabot[bot]' && (success() || failure()) + - name: prepare sonar reports + if: success() || failure() run: | - export SONAR_VERSION="4.7.0.2747" - wget -q --max-redirect=0 "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_VERSION}.zip" -O sonar-scanner.zip - unzip -q ./sonar-scanner.zip - mv ./sonar-scanner-${SONAR_VERSION} ./sonar-scanner + cat sonar-project.properties scripts/sonar_tests.py - - name: run sonar scan - if: github.actor != 'dependabot[bot]' && (success() || failure()) - run: | - PATH="$PWD/sonar-scanner/bin:$PATH" - sonar-scanner - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: sonar scan + if: success() || failure() + uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: publish junit reports if: success() || failure() diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b538a52..6904c5a 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -107,29 +107,16 @@ jobs: with: distribution: "corretto" java-version: "17" - - - name: provision sonar-scanner + + - name: prepare sonar reports if: success() || failure() run: | - export SONAR_VERSION="4.7.0.2747" - wget -q --max-redirect=0 "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_VERSION}.zip" -O sonar-scanner.zip - unzip -q ./sonar-scanner.zip - mv ./sonar-scanner-${SONAR_VERSION} ./sonar-scanner + cat sonar-project.properties scripts/sonar_tests.py - - name: run sonar scan + - name: sonar scan if: success() || failure() - run: | - PATH="$PWD/sonar-scanner/bin:$PATH" - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - git checkout "${GITHUB_HEAD_REF}" - sonar-scanner -Dsonar.pullrequest.branch="{{ github.event.pull_request.head.sha }}" -Dsonar.pullrequest.base="{{ github.event.pull_request.base.sha }}" -Dsonar.pullrequest.key="${{ github.event.number }}" - else - sonar-scanner - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: archive reports if: success() || failure() diff --git a/scripts/sonar_tests.py b/scripts/sonar_tests.py index 49abe74..f5010fe 100755 --- a/scripts/sonar_tests.py +++ b/scripts/sonar_tests.py @@ -95,10 +95,15 @@ def _transform_coverage(reports_dir: str, output_sonar: str): out.write(coverage) + def _transform_xunit_results(reports_dir: str, output_sonar: str): src_junit = os.path.join(reports_dir, "junit") out_tests = os.path.join(output_sonar, "tests.xml") + if not os.path.isdir(src_junit): + print("no junit found") + return + dom_out = dom.getDOMImplementation().createDocument(None, "testExecutions", None) dom_out.documentElement.setAttribute("version", "1") all_tests: dict[str, list[dom.Element]] = defaultdict(list) From 98663bbeb4c2b9ca9f4c9a7e0916bfb59ae042c9 Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Thu, 30 Jul 2026 15:22:29 +0100 Subject: [PATCH 2/8] mesh-2925: black changes --- scripts/sonar_tests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/sonar_tests.py b/scripts/sonar_tests.py index f5010fe..c174d5d 100755 --- a/scripts/sonar_tests.py +++ b/scripts/sonar_tests.py @@ -95,7 +95,6 @@ def _transform_coverage(reports_dir: str, output_sonar: str): out.write(coverage) - def _transform_xunit_results(reports_dir: str, output_sonar: str): src_junit = os.path.join(reports_dir, "junit") out_tests = os.path.join(output_sonar, "tests.xml") @@ -103,7 +102,7 @@ def _transform_xunit_results(reports_dir: str, output_sonar: str): if not os.path.isdir(src_junit): print("no junit found") return - + dom_out = dom.getDOMImplementation().createDocument(None, "testExecutions", None) dom_out.documentElement.setAttribute("version", "1") all_tests: dict[str, list[dom.Element]] = defaultdict(list) From 47403e216194fe0b0b9fc55bbbaac7c88f2a9b8e Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Thu, 30 Jul 2026 15:26:05 +0100 Subject: [PATCH 3/8] mesh-2925: remove java --- .github/workflows/merge-develop.yml | 7 ------- .github/workflows/pull-request.yml | 7 ------- 2 files changed, 14 deletions(-) diff --git a/.github/workflows/merge-develop.yml b/.github/workflows/merge-develop.yml index 38106b5..ff1d242 100644 --- a/.github/workflows/merge-develop.yml +++ b/.github/workflows/merge-develop.yml @@ -50,13 +50,6 @@ jobs: sudo apt update sudo apt-get install unrar -yq - - name: setup java - if: success() || failure() - uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0 - with: - distribution: "corretto" - java-version: "11" - - name: start docker containers run: make up diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6904c5a..2307eb6 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -101,13 +101,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} thresholdAll: 0.85 - - name: setup java - if: success() || failure() - uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0 - with: - distribution: "corretto" - java-version: "17" - - name: prepare sonar reports if: success() || failure() run: | From f6797c7e377d40807fe5260c24bc38844dc8df76 Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Thu, 30 Jul 2026 15:27:15 +0100 Subject: [PATCH 4/8] mesh-2925: remove java --- .github/workflows/merge-develop.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/merge-develop.yml b/.github/workflows/merge-develop.yml index ff1d242..ec7d26e 100644 --- a/.github/workflows/merge-develop.yml +++ b/.github/workflows/merge-develop.yml @@ -50,6 +50,13 @@ jobs: sudo apt update sudo apt-get install unrar -yq + - name: setup java + if: success() || failure() + uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0 + with: + distribution: "corretto" + java-version: "11" + - name: start docker containers run: make up @@ -64,13 +71,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} thresholdAll: 0.85 - - name: setup java - if: github.actor != 'dependabot[bot]' && (success() || failure()) - uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0 - with: - distribution: "corretto" - java-version: "17" - - name: prepare sonar reports if: success() || failure() run: | From 28660d670f3df4ea564663bc0db008789b5b8636 Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Tue, 4 Aug 2026 10:26:34 +0100 Subject: [PATCH 5/8] mesh-2925: sonar fix --- .github/workflows/merge-develop.yml | 4 +++- .github/workflows/pull-request.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge-develop.yml b/.github/workflows/merge-develop.yml index ec7d26e..8a53e3b 100644 --- a/.github/workflows/merge-develop.yml +++ b/.github/workflows/merge-develop.yml @@ -78,7 +78,9 @@ jobs: scripts/sonar_tests.py - name: sonar scan - if: success() || failure() + if: (success() || failure()) && secrets.SONAR_TOKEN != '' + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: publish junit reports diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2307eb6..ddcc67c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -108,7 +108,9 @@ jobs: scripts/sonar_tests.py - name: sonar scan - if: success() || failure() + if: (success() || failure()) && secrets.SONAR_TOKEN != '' + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: archive reports From c0ce123ee106f58447c6c4e0f5b9ec890b6cce03 Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Tue, 4 Aug 2026 11:00:42 +0100 Subject: [PATCH 6/8] mesh-2925: sonar fix --- .github/workflows/merge-develop.yml | 6 +++--- .github/workflows/pull-request.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/merge-develop.yml b/.github/workflows/merge-develop.yml index 8a53e3b..23242d8 100644 --- a/.github/workflows/merge-develop.yml +++ b/.github/workflows/merge-develop.yml @@ -7,6 +7,8 @@ on: jobs: coverage: runs-on: ubuntu-latest + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} permissions: contents: write checks: write @@ -78,9 +80,7 @@ jobs: scripts/sonar_tests.py - name: sonar scan - if: (success() || failure()) && secrets.SONAR_TOKEN != '' - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + if: (success() || failure()) && env.SONAR_TOKEN != '' uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: publish junit reports diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index ddcc67c..3fb0d1c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,6 +7,8 @@ on: jobs: coverage: runs-on: ubuntu-latest + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} permissions: contents: write checks: write @@ -108,9 +110,7 @@ jobs: scripts/sonar_tests.py - name: sonar scan - if: (success() || failure()) && secrets.SONAR_TOKEN != '' - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + if: (success() || failure()) && env.SONAR_TOKEN != '' uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: archive reports From 454e1f03929c92179fd85cc3bd230a8fbc5719bc Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Tue, 4 Aug 2026 12:08:03 +0100 Subject: [PATCH 7/8] mesh-2925: sonar fix --- .github/workflows/merge-develop.yml | 2 +- .github/workflows/pull-request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge-develop.yml b/.github/workflows/merge-develop.yml index 23242d8..85dc4ca 100644 --- a/.github/workflows/merge-develop.yml +++ b/.github/workflows/merge-develop.yml @@ -80,7 +80,7 @@ jobs: scripts/sonar_tests.py - name: sonar scan - if: (success() || failure()) && env.SONAR_TOKEN != '' + if: success() || failure() uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: publish junit reports diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3fb0d1c..3b16661 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -110,7 +110,7 @@ jobs: scripts/sonar_tests.py - name: sonar scan - if: (success() || failure()) && env.SONAR_TOKEN != '' + if: success() || failure() uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: archive reports From 63a9476a0dcf62dbe186913cef94678df8559ce0 Mon Sep 17 00:00:00 2001 From: james-bradley-nhs Date: Tue, 4 Aug 2026 12:13:15 +0100 Subject: [PATCH 8/8] mesh-2925: sonar fix --- .github/workflows/merge-develop.yml | 5 +++-- .github/workflows/pull-request.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/merge-develop.yml b/.github/workflows/merge-develop.yml index 85dc4ca..dd7c734 100644 --- a/.github/workflows/merge-develop.yml +++ b/.github/workflows/merge-develop.yml @@ -7,8 +7,6 @@ on: jobs: coverage: runs-on: ubuntu-latest - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} permissions: contents: write checks: write @@ -81,6 +79,9 @@ jobs: - name: sonar scan if: success() || failure() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: publish junit reports diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3b16661..6eae776 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,8 +7,6 @@ on: jobs: coverage: runs-on: ubuntu-latest - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} permissions: contents: write checks: write @@ -111,6 +109,9 @@ jobs: - name: sonar scan if: success() || failure() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 - name: archive reports