Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCSCANGHA-13 Warning instead of failure for Maven/Gradle projects #76

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
34 changes: 16 additions & 18 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,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 @@ -79,14 +79,13 @@ jobs:
SONAR_TOKEN: FAKE_TOKEN
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
failFastGradleKotlinTest:
./test/assertFileExists ./output.properties
dontFailGradleKotlinTest:
name: >
Fail fast on Kotlin Gradle project
Don't fail on Kotlin Gradle project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -100,14 +99,13 @@ jobs:
SONAR_TOKEN: FAKE_TOKEN
with:
projectBaseDir: ./test/gradle-project-kotlin
- 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 @@ -121,11 +119,10 @@ jobs:
SONAR_TOKEN: FAKE_TOKEN
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
runnerDebugUsedTest:
name: >
'RUNNER_DEBUG' is used
Expand All @@ -144,3 +141,4 @@ jobs:
- name: Assert
run: |
./test/assertFileContains ./output.properties "sonar.verbose=true"

8 changes: 4 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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. Sonar recommends running the 'org.sonarsource.scanner.maven:sonar-maven-plugin:sonar' goal during the build process instead of using this GitHub Action
to get more accurate results."
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. Sonar recommends using the SonarQube plugin for Gradle during the build process instead of using this GitHub Action
to get more accurate results."
fi

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