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
21 changes: 6 additions & 15 deletions .github/workflows/merge-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.70

- name: setup java
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: "corretto"
java-version: "17"

- name: provision sonar-scanner
- name: prepare sonar reports
if: success() || failure()
run: |
export SONAR_VERSION="5.0.1.3006"
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
Comment on lines +59 to 63

- name: run sonar scan
run: |
PATH="$PWD/sonar-scanner/bin:$PATH"
sonar-scanner
- name: sonar scan
if: success() || failure()
uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
26 changes: 6 additions & 20 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,29 +139,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.70

- name: setup java
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: "corretto"
java-version: "17"

- name: provision sonar-scanner
- name: prepare sonar reports
if: success() || failure()
run: |
export SONAR_VERSION="5.0.1.3006"
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
Comment on lines +142 to 146

- name: run sonar scan
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
- name: sonar scan
if: success() || failure()
uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
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
Loading