Skip to content

Commit

Permalink
CQI-14: Integrated Sonarcloud scan with java 17 (#22)
Browse files Browse the repository at this point in the history
* CQI-14: Bumped sonarcloud java version to ver 17

* CQI-14: Temporarily enabled sonarcloud scan for all branches

* CQI-14: Bumped up groovy version

* CQI-14: Disable demo data loading for integration tests

Demo data was previously being loaded before the tests were run, so they were affected by records fetched from a csv.

* CQI-14: Bumped sonarcloud java version to ver 17

* CQI-14: Downgraded Gradle to ver. 4.10

* CQI-14: Bumped PMD to 6.0.1

* CQI-14: Use OpenLMIS/dev:7

* CQI-14: Revert sonarcloud scan for all branches

* CQI-14: Revert 'Bumped up groovy version'
  • Loading branch information
anawrotsoldevelo committed Feb 1, 2024
1 parent 86aa999 commit 187c569
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sonar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- name: Cache SonarCloud packages
uses: actions/cache@v3
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ sonarqube {
property "sonar.projectKey", "OpenLMIS_openlmis-template-service"
property "sonar.organization", "openlmis"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.java.source", "11"
property "sonar.java.source", "17"
property "sonar.coverage.jacoco.xmlReportPaths", "./report.xml"
}
}
Expand All @@ -190,7 +190,6 @@ pmd {
ignoreFailures = false
ruleSetFiles = files("config/pmd/ruleset.xml")
reportsDir = file("build/reports/pmd")
incrementalAnalysis = false
}

tasks.withType(Pmd){
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.builder.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "2"
services:
builder:
image: openlmis/dev:6
image: openlmis/dev:7
links:
- db
- log
Expand All @@ -15,7 +15,7 @@ services:
JAVA_OPTS: '-Dlogging.config=/logback.xml'
env_file: .env
sonar:
image: openlmis/dev:6
image: openlmis/dev:7
links:
- db
- log
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "2"
services:
template-service:
image: openlmis/dev:6
image: openlmis/dev:7
ports:
- "5005:5005"
- "8080:8080"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
53 changes: 20 additions & 33 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -44,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -82,7 +66,6 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -126,11 +109,10 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -156,19 +138,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
i=$((i+1))
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -177,9 +159,14 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
22 changes: 1 addition & 21 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -29,11 +13,8 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down Expand Up @@ -84,7 +65,6 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.springframework.transaction.annotation.Transactional;

@Transactional
@ActiveProfiles({"test", "init-audit-log"})
@ActiveProfiles({"test", "init-audit-log", "test-run"})
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class AuditLogInitializerIntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.springframework.transaction.annotation.Transactional;

@Transactional
@ActiveProfiles("test")
@ActiveProfiles({"test", "test-run"})
@RunWith(SpringRunner.class)
@SpringBootTest
public class JaVersIntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("test")
@ActiveProfiles({"test", "test-run"})
public class ExposedMessageSourceIntegrationTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("test")
@ActiveProfiles({"test", "test-run"})
@Transactional
public abstract class BaseCrudRepositoryIntegrationTest<T extends BaseEntity> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
@ActiveProfiles({"test", "test-run"})
@SuppressWarnings({"PMD.TooManyMethods"})
public abstract class BaseWebIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.springframework.stereotype.Component;

@Component
@Profile("demo-data")
@Profile("demo-data & !test-run")
@Order(5)
public class TestDataInitializer implements CommandLineRunner {
private static final XLogger XLOGGER = XLoggerFactory.getXLogger(TestDataInitializer.class);
Expand Down

0 comments on commit 187c569

Please sign in to comment.