diff --git a/test/gradle-project/build.gradle b/test/gradle-project/build.gradle new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/gradle-project/build.gradle @@ -0,0 +1 @@ + diff --git a/test/maven-project/pom.xml b/test/maven-project/pom.xml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/maven-project/pom.xml @@ -0,0 +1 @@ + diff --git a/test/run-qa.sh b/test/run-qa.sh index 445471d..47b1f3f 100755 --- a/test/run-qa.sh +++ b/test/run-qa.sh @@ -50,6 +50,42 @@ if [[ -z "$token" ]]; then fi success "New token generated." +info "Test fail-fast if SONAR_TOKEN is omitted..." +docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network sonarsource/sonarqube-scan-action +if [[ $? -eq 0 ]]; then + error "Should have failed fast." + exit 1 +fi +success "Correctly failed fast." + +info "Test fail-fast if SONAR_HOST_URL is omitted..." +docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env SONAR_TOKEN=$token sonarsource/sonarqube-scan-action +if [[ $? -eq 0 ]]; then + error "Should have failed fast." + exit 1 +fi +success "Correctly failed fast." + +info "Test fail-fast on Gradle project..." +pushd test/gradle-project/ +docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env SONAR_TOKEN=$token --env SONAR_HOST_URL='http://sonarqube:9000' sonarsource/sonarqube-scan-action +if [[ $? -eq 0 ]]; then + error "Should have failed fast." + exit 1 +fi +popd +success "Correctly failed fast." + +info "Test fail-fast on Maven project..." +pushd test/maven-project/ +docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env SONAR_TOKEN=$token --env SONAR_HOST_URL='http://sonarqube:9000' sonarsource/sonarqube-scan-action +if [[ $? -eq 0 ]]; then + error "Should have failed fast." + exit 1 +fi +popd +success "Correctly failed fast." + info "Analyze project..." cd test/example-project/ docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env SONAR_TOKEN=$token --env SONAR_HOST_URL='http://sonarqube:9000' sonarsource/sonarqube-scan-action