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

chore: Enable jacoco code coverage #14

Merged
merged 1 commit into from
May 15, 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
11 changes: 8 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
distribution: 'temurin'

- name: Build the plugin using Gradle
run: ./gradlew buildPlugin
run: ./gradlew check buildPlugin

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -39,11 +39,16 @@ jobs:
strategy:
matrix:
ide-version:
- clion:2024.1
- goland:2024.1
- ideaIC:2024.1
- ideaIC:LATEST-EAP-SNAPSHOT
- ideaIU:2024.1
- goland:2024.1
- phpstorm:2024.1
- pycharmPC:2024.1
- pycharmPY:2024.1
- riderRD:2024.1
- ideaIC:LATEST-EAP-SNAPSHOT
- webstorm:2024.1
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand Down
79 changes: 47 additions & 32 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

plugins {
id("java")
id("jacoco")
id("org.jetbrains.kotlin.jvm") version "1.9.24"
id("org.jetbrains.intellij") version "1.17.3"
id("org.jetbrains.grammarkit") version "2022.3.2"

id("jacoco")
}

group = "dev.openfga.intellijplugin"
version = "0.1.0"
sourceSets["main"].java.srcDirs("src/main/java", "src/generated/java")

repositories {
mavenCentral()
Expand All @@ -23,10 +22,6 @@ dependencies {
testImplementation("junit:junit:4.13.2")
}


sourceSets["main"].java.srcDirs("src/generated/java", "src/main/java")


// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
Expand All @@ -42,23 +37,23 @@ grammarKit {
intellijRelease.set("203.7717.81")
}

tasks {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
}
}

compileJava {
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
sourceCompatibility = "17"
targetCompatibility = "17"
dependsOn("generateLexer", "generateParser")
}

dependsOn(
generateLexer,
generateParser,
)
}
tasks {

// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
check {
dependsOn(jacocoTestReport)
}

generateLexer {
Expand All @@ -71,13 +66,41 @@ tasks {
generateParser {
sourceFile.set(file("src/main/java/dev/openfga/intellijplugin/parsing/openfga.bnf"))
targetRoot.set("src/generated/java")
pathToParser.set("dev/openfga/intellijplugin/parsing/RustParser.java")
pathToParser.set("dev/openfga/intellijplugin/parsing/OpenFGAParser.java")
pathToPsiRoot.set("dev/openfga/intellijplugin/psi")
purgeOldFiles.set(true)
}

test {
useJUnit()

configure<JacocoTaskExtension> {
isEnabled = true
isIncludeNoLocationClasses = true
excludes = listOf("jdk.internal.*")
}

testLogging {
showStandardStreams = true
events("PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR")
}
}

jacocoTestReport {
classDirectories.setFrom(instrumentCode)

reports {
xml.required = true
html.required = true
}
}

jacocoTestCoverageVerification {
classDirectories.setFrom(instrumentCode)
}

patchPluginXml {
sinceBuild.set("222")
sinceBuild.set("233")
untilBuild.set("241.*")
}

Expand All @@ -88,14 +111,6 @@ tasks {
}

publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}

test {
finalizedBy(jacocoTestReport)
}

jacocoTestReport {
dependsOn(test)
token.set(System.getenv("JETBRAINS_API_TOKEN"))
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ org.gradle.caching=true

pluginGroup=dev.openfga.intellijplugin
pluginName=OpenFgaIntellijPlugin
pluginVersion=0.0.1
pluginVersion=0.1.0