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

feat: added task to install a specific version of Corepack #227

Merged
merged 1 commit into from
Jun 9, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
key: ${{ runner.os }}-sonar-${{ hashFiles('**/*.gradle*') }}

- name: Grant executable permission
run: chmod +x gradlew plugin/src/intTest/resources/*/bin/*
run: chmod +x gradlew plugin/src/integrationTest/resources/*/bin/*

- name: Build plugin on Linux (with test coverage)
if: matrix.os == 'ubuntu-22.04'
Expand All @@ -89,4 +89,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew :plugin:sonar --console=plain -Dorg.gradle.jvmargs=-Xmx512m -Dsonar.verbose=true
run: ./gradlew :plugin:sonar --console=plain -Dorg.gradle.jvmargs=-Xmx512m
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ The project relies on [GitHub Actions][github-actions] to integrate continuously
repository. The configuration actually allows to build and test the plugin with Adoptium Temurin JDK 17 64 bits, on the
environments below:

- Linux Ubuntu 22.04.2
- Mac OS 12.6.5
- Linux Ubuntu 22.04.4
- Mac OS 14.5
- Windows Server 2022

Ubuntu is the reference O/S, used to analyze the source code with SonarCloud. Developments are frequently done on a
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ With their feedback, plugin improvement is possible. Special thanks to:
@[joschi](https://github.com/joschi),
@[jorgheymans](https://github.com/jorgheymans),
@[ludik0](https://github.com/ludik0),
@[marcospereira](https://github.com/marcospereira),
@[mhalbritter](https://github.com/mhalbritter),
@[mike-howell](https://github.com/mike-howell),
@[napstr](https://github.com/napstr),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
nodeInstallDirectory.set(file(rootProject.ext.get("nodeInstallDirectory")!!))
}

Expand Down
2 changes: 1 addition & 1 deletion examples/npm-application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
2 changes: 1 addition & 1 deletion examples/pnpm-application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
2 changes: 1 addition & 1 deletion examples/yarn-application-with-pnp-linker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

frontend {
nodeVersion.set("18.17.1")
nodeVersion.set("20.14.0")
assembleScript.set("run build")
cleanScript.set("run clean")
checkScript.set("run check")
Expand Down
109 changes: 55 additions & 54 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ java {
}

sourceSets {
create("intTest") {
create("integrationTest") {
compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output
runtimeClasspath += sourceSets.main.get().output + sourceSets.test.get().output
}
}

val intTestImplementation: Configuration by configurations.getting {
val integrationTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.implementation.get())
extendsFrom(configurations.testImplementation.get())
}

configurations["intTestRuntimeOnly"]
configurations["integrationTestRuntimeOnly"]
.extendsFrom(configurations.runtimeOnly.get())
.extendsFrom(configurations.testRuntimeOnly.get())

Expand All @@ -69,56 +69,14 @@ dependencies {
testCompileOnly("org.projectlombok:lombok:1.18.32")
testAnnotationProcessor("org.projectlombok:lombok:1.18.32")

intTestImplementation("org.wiremock:wiremock:3.6.0")
integrationTestImplementation("org.wiremock:wiremock:3.6.0")
}

tasks.named<Wrapper>("wrapper") {
distributionType = Wrapper.DistributionType.ALL
}

tasks.withType<Test> {
useJUnitPlatform()
jvmArgs(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED"
)
outputs.upToDateWhen { false }
}

tasks.register<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["intTest"].output.classesDirs
classpath = sourceSets["intTest"].runtimeClasspath
// Yarn immutable installs prevents failures in integration tests due to missing yarn.lock file.
environment["YARN_ENABLE_IMMUTABLE_INSTALLS"] = "false"
shouldRunAfter("test")
outputs.upToDateWhen { false }
}

tasks.named<Task>("check") {
dependsOn(tasks.named("integrationTest"))
}

tasks.named<JacocoReport>("jacocoTestReport") {
dependsOn(tasks.named("test"), tasks.named("integrationTest"))
executionData.setFrom(
file("${project.layout.buildDirectory}/jacoco/test.exec"),
file("${project.layout.buildDirectory}/jacoco/integrationTest.exec")
)
reports {
xml.required.set(true)
xml.outputLocation.set(file("${project.layout.buildDirectory}/reports/jacoco/report.xml"))
}
}

gradle.addListener(GradleTestListener(logger))

idea {
module {
// Force integration test source set as test folder
testSources.from(project.sourceSets.getByName("intTest").java.srcDirs)
testResources.from(project.sourceSets.getByName("intTest").resources.srcDirs)
testSources.from(project.sourceSets.getByName("integrationTest").java.srcDirs)
testResources.from(project.sourceSets.getByName("integrationTest").resources.srcDirs)
isDownloadJavadoc = true
isDownloadSources = true
}
Expand Down Expand Up @@ -151,24 +109,67 @@ sonarqube {
property("sonar.projectVersion", "${fgpVersion}-jdk17")

property("sonar.links.homepage", "https://github.com/siouan/frontend-gradle-plugin")
property("sonar.links.ci", "https://travis-ci.com/siouan/frontend-gradle-plugin")
property("sonar.links.ci", "https://github.com/siouan/frontend-gradle-plugin/actions")
property("sonar.links.scm", "https://github.com/siouan/frontend-gradle-plugin")
property("sonar.links.issue", "https://github.com/siouan/frontend-gradle-plugin/issues")

property("sonar.sources", "src/main")
property("sonar.tests", "src/test,src/intTest")
property("sonar.tests", "src/test,src/integrationTest")

property("sonar.java.binaries", "build/classes/java/main")
property("sonar.java.test.binaries", "build/classes/java/test,build/classes/java/intTest")
property("sonar.java.test.binaries", "build/classes/java/test,build/classes/java/integrationTest")
property("sonar.junit.reportPaths", "build/test-results/test/,build/test-results/integrationTest/")
property("sonar.jacoco.xmlReportPaths", "${project.layout.buildDirectory}/reports/jacoco/report.xml")
property("sonar.java.test.binaries", "build/classes/java/test,build/classes/java/intTest")
property("sonar.jacoco.xmlReportPaths", "build/reports/jacoco/report.xml")
property("sonar.verbose", true)

// Irrelevant duplications detected on task inputs
property(
"sonar.cpd.exclusions",
"**/org/siouan/frontendgradleplugin/domain/model/*.java,**/org/siouan/frontendgradleplugin/domain/usecase/Resolve*ExecutablePath.java,**/org/siouan/frontendgradleplugin/infrastructure/gradle/FrontendExtension.java"
"**/org/siouan/frontendgradleplugin/domain/Resolve*ExecutablePath.java,**/org/siouan/frontendgradleplugin/infrastructure/gradle/FrontendExtension.java"
)
}
}

tasks.named<Wrapper>("wrapper") {
distributionType = Wrapper.DistributionType.ALL
}

tasks.withType<Test>() {
useJUnitPlatform()
}

tasks.named<Test>("test") {
jvmArgs(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED"
)
outputs.upToDateWhen { false }
}

tasks.register<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
// Yarn immutable installs prevents failures in integration tests due to missing yarn.lock file.
environment["YARN_ENABLE_IMMUTABLE_INSTALLS"] = "false"
shouldRunAfter("test")
outputs.upToDateWhen { false }
}

tasks.named<Task>("check") {
dependsOn(tasks.named("integrationTest"))
}

tasks.named<JacocoReport>("jacocoTestReport") {
dependsOn(tasks.named("test"), tasks.named("integrationTest"))
executionData.setFrom(
project.layout.buildDirectory.files("jacoco/test.exec", "jacoco/integrationTest.exec"),
)
reports {
xml.required.set(true)
xml.outputLocation.set(project.layout.buildDirectory.file("reports/jacoco/report.xml"))
}
}

gradle.addListener(GradleTestListener(logger))
Loading
Loading