Skip to content

Commit

Permalink
[Karate-Tools] Sonar Setup (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
teresamib authored Dec 5, 2024
1 parent 20b6fc3 commit f4b6abb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/code-maven_java-PR_verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
run: |
echo "app-version=$(yq -oy '.project.version' code/pom.xml)" >> "$GITHUB_OUTPUT"
echo "app-name=$(yq -oy '.project.artifactId' code/pom.xml)" >> "$GITHUB_OUTPUT"
echo "github-repository=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" >> "$GITHUB_OUTPUT"
- name: Maven / Verify artifact with coverage
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'autopublish/snapshot-binaries')) }}
Expand Down Expand Up @@ -121,7 +122,7 @@ jobs:
run: |
JACOCO_REPORT_PATH="$GITHUB_WORKSPACE/code/jacoco-report-aggregate/target/site/jacoco-aggregate/jacoco.xml"
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar \
-Dsonar.projectKey=InditexTech_"${{ steps.version.outputs.app-name }}" \
-Dsonar.projectKey=InditexTech_"${{ steps.version.outputs.github-repository }}" \
-Dsonar.projectName="${{ steps.version.outputs.app-name }}" \
-Dsonar.projectVersion="${{ steps.version.outputs.app-version }}" \
-Dsonar.host.url="https://sonarcloud.io/" \
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/code-maven_java-sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
run: |
echo "app-version=$(yq -oy '.project.version' code/pom.xml)" >> "$GITHUB_OUTPUT"
echo "app-name=$(yq -oy '.project.artifactId' code/pom.xml)" >> "$GITHUB_OUTPUT"
echo "github-repository=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" >> "$GITHUB_OUTPUT"
- name: SonarCloud / Setup asdf tools
uses: asdf-vm/actions/install@v3
Expand Down Expand Up @@ -120,7 +121,7 @@ jobs:
run: |
JACOCO_REPORT_PATH="$GITHUB_WORKSPACE/code/jacoco-report-aggregate/target/site/jacoco-aggregate/jacoco.xml"
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar \
-Dsonar.projectKey=InditexTech_"${{ steps.version.outputs.app-name }}" \
-Dsonar.projectKey=InditexTech_"${{ steps.version.outputs.github-repository }}" \
-Dsonar.projectName="${{ steps.version.outputs.app-name }}" \
-Dsonar.projectVersion="${{ github.event.release.tag_name }}" \
-Dsonar.branch.name="release/${{ github.event.release.tag_name }}" \
Expand All @@ -138,7 +139,7 @@ jobs:
run: |
JACOCO_REPORT_PATH="$GITHUB_WORKSPACE/code/jacoco-report-aggregate/target/site/jacoco-aggregate/jacoco.xml"
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar \
-Dsonar.projectKey=InditexTech_"${{ steps.version.outputs.app-name }}" \
-Dsonar.projectKey=InditexTech_"${{ steps.version.outputs.github-repository }}" \
-Dsonar.projectName="${{ steps.version.outputs.app-name }}" \
-Dsonar.projectVersion="${{ steps.version.outputs.app-version }}" \
-Dsonar.branch.name="${{ github.base_ref || github.ref_name }}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public String getId() {
*/
public static MavenArtifact fromId(final String id) {
if (id.indexOf(":") >= 0 && id.split(":").length == 2) {
final String groupId = id.split(":")[0];
final String artifactId = id.split(":")[1];
return new MavenArtifact(groupId, artifactId);
return new MavenArtifact(id.split(":")[0], id.split(":")[1]);
}
return null;
}
Expand Down

0 comments on commit f4b6abb

Please sign in to comment.