Skip to content

Commit

Permalink
SCSCANGHA-13 Warning instead of failure for Maven/Gradle projects
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-vinot-sonarsource committed May 20, 2024
1 parent 3da91d8 commit 73e75c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
SONAR_TOKEN: FAKE_TOKEN
with:
projectBaseDir: ./test/gradle-project
args: -Dsonar.scanner.dumpToFile=./output.properties
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
run: |
Expand All @@ -100,6 +101,7 @@ jobs:
SONAR_TOKEN: FAKE_TOKEN
with:
projectBaseDir: ./test/gradle-project-kotlin
args: -Dsonar.scanner.dumpToFile=./output.properties
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
run: |
Expand All @@ -121,6 +123,7 @@ jobs:
SONAR_TOKEN: FAKE_TOKEN
with:
projectBaseDir: ./test/maven-project
args: -Dsonar.scanner.dumpToFile=./output.properties
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
run: |
Expand Down
6 changes: 2 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ if [[ -z "${SONAR_TOKEN}" ]]; then
fi

if [[ -f "${INPUT_PROJECTBASEDIR%/}/pom.xml" ]]; then
echo "Maven project detected. You should run the goal 'org.sonarsource.scanner.maven:sonar' during build rather than using this GitHub Action."
exit 1
echo "WARNING! Maven project detected, you might have only partial analysis. You can run the goal 'org.sonarsource.scanner.maven:sonar' during build instead of this GitHub Action."
fi

if [[ -f "${INPUT_PROJECTBASEDIR%/}/build.gradle" || -f "${INPUT_PROJECTBASEDIR%/}/build.gradle.kts" ]]; then
echo "Gradle project detected. You should use the SonarQube plugin for Gradle during build rather than using this GitHub Action."
exit 1
echo "WARNING! Gradle project detected, you might have only partial analysis. You can use the SonarQube plugin for Gradle during build instead of this GitHub Action."
fi

if [[ -z "${SONARCLOUD_URL}" ]]; then
Expand Down

0 comments on commit 73e75c0

Please sign in to comment.