Skip to content

Commit

Permalink
build: Reintroduce integration tests with the upcoming SonarQube version
Browse files Browse the repository at this point in the history
  • Loading branch information
felipebz committed Feb 23, 2024
1 parent ce1368f commit af6f456
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
sqVersion:
- LATEST_RELEASE[9.9]
- LATEST_RELEASE[10.4]
- SNAPSHOT
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -37,9 +38,21 @@ jobs:
- name: Build custom rules example
run: ./gradlew build -p plsql-custom-rules

- name: Run integration test
- if: matrix.sqVersion != 'SNAPSHOT'
name: Run integration test
run: ./gradlew integrationTest -Dsonar.runtimeVersion=${{ matrix.sqVersion }} --info

- if: matrix.sqVersion == 'SNAPSHOT'
name: Run integration test
run: |
SQ_VERSION=10.5
curl -s -L "https://nexus.felipezorzo.com.br/service/rest/v1/search/assets/download?repository=maven-snapshots&maven.groupId=org.sonarsource.sonarqube&maven.artifactId=sonar-application&maven.extension=zip&sort=version&maven.baseVersion=$SQ_VERSION-SNAPSHOT" \
-u "$AUTH_REPOSITORY" \
-o sonar-zpa-plugin/sonar-application-$SQ_VERSION.zip
./gradlew integrationTest -Dsonar.zipFile=sonar-application-$SQ_VERSION.zip --info
env:
AUTH_REPOSITORY: ${{ secrets.AUTH_REPOSITORY }}

windows-build:
name: Test on Windows
runs-on: windows-latest
Expand Down
4 changes: 4 additions & 0 deletions sonar-zpa-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ testing {
all {
testTask.configure {
val runtimeVersion = System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE[9.9]")
val zipFile = System.getProperty("sonar.zipFile")

val launcher = javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(17))
Expand All @@ -43,6 +44,9 @@ testing {
environment("JAVA_HOME", launcher.get().metadata.installationPath.asFile.toString())
systemProperty("java.awt.headless", "true")
systemProperty("sonar.runtimeVersion", runtimeVersion)
if (zipFile != null) {
systemProperty("sonar.zipFile", zipFile)
}
outputs.upToDateWhen { false }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ object Tests {
val ORCHESTRATOR: OrchestratorExtension =
OrchestratorExtension.builderEnv()
.useDefaultAdminCredentialsForBuilds(true)
.setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE[9.9]"))
.apply {
val zipFile = System.getProperty("sonar.zipFile")
if (zipFile != null) {
setZipFile(File(zipFile))
} else {
setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE[9.9]"))
}
}
.setOrchestratorProperty("orchestrator.artifactory.url", "https://repo1.maven.org/maven2")
.addPlugin(FileLocation.byWildcardMavenFilename(
File("build/libs"),
Expand Down

0 comments on commit af6f456

Please sign in to comment.