Skip to content

Commit

Permalink
SQSCANGHA-26 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 d3ca174 commit 120e254
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
run: |
echo "Expected previous step to fail"
exit 1
failFastGradleTest:
dontFailGradleTest:
name: >
Fail fast on Gradle project
Don't fail on Gradle project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -77,14 +77,13 @@ jobs:
SONAR_HOST_URL: http://not_actually_used
with:
projectBaseDir: ./test/gradle-project
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
args: -Dsonar.scanner.dumpToFile=./output.properties
- name: Assert
run: |
echo "Expected previous step to fail"
exit 1
failFastMavenTest:
./test/assertFileExists ./output.properties
dontFailMavenTest:
name: >
Fail fast on Maven project
Don't fail on Maven project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -98,11 +97,10 @@ jobs:
SONAR_HOST_URL: http://not_actually_used
with:
projectBaseDir: ./test/maven-project
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
args: -Dsonar.scanner.dumpToFile=./output.properties
- name: Assert
run: |
echo "Expected previous step to fail"
exit 1
./test/assertFileExists ./output.properties
runAnalysisTest:
runs-on: ubuntu-latest
services:
Expand Down
6 changes: 2 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ if [[ -n "${SONAR_ROOT_CERT}" ]]; 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" ]]; 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

unset JAVA_HOME
Expand Down

0 comments on commit 120e254

Please sign in to comment.