Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions .github/workflows/merge-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,18 @@ 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: 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
- 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
if: success() || failure()
Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,35 +101,18 @@ 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: 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()
Expand Down
4 changes: 4 additions & 0 deletions scripts/sonar_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ 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)
Expand Down