Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
EnzDev committed Dec 4, 2024
1 parent 62ced0e commit 5f30463
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 79 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:

# Prepare environment and build the plugin
Expand All @@ -36,26 +36,24 @@ jobs:
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:

# Check out current repository
# Check out the current repository
- name: Fetch Sources
uses: actions/checkout@v4

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v3
uses: gradle/actions/wrapper-validation@v3

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Set environment variables
- name: Export Properties
Expand Down Expand Up @@ -111,13 +109,11 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Run tests
- name: Run Tests
Expand Down Expand Up @@ -167,11 +163,11 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
java-version: 17

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/[email protected].6
uses: JetBrains/[email protected]
with:
cache-default-branch-only: true

Expand All @@ -198,13 +194,11 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Set environment variables
- name: Export Properties
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Run IDEA prepared for UI testing
- name: Run IDE
Expand Down
116 changes: 65 additions & 51 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
id("java") // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.intelliJPlatformPlugin) // IntelliJ Platform Plugin
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
}

group = properties("pluginGroup").get()
version = properties("pluginVersion").get()
group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()

// Configure project's dependencies
repositories {
Expand All @@ -26,42 +24,40 @@ repositories {

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
implementation(libs.annotations)
testImplementation(libs.junit)

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
create(properties("platformType"), properties("platformVersion"))
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))

pluginVerifier()
zipSigner()
instrumentationTools()

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins(properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) })
bundledPlugins(properties("platformBundledPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) })
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
}
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, Java 17 for 2022.2+, and Java 21 for 2024.2+.
// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(properties("javaVersion").get().toInt())
jvmToolchain(17)
}

// Configure IntelliJ Platform Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
pluginConfiguration {
name = properties("pluginName")
version = properties("pluginVersion")

ideaVersion {
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
}
version = providers.gradleProperty("pluginVersion")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with (it.lines()) {
with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
Expand All @@ -71,7 +67,7 @@ intellijPlatform {

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = properties("pluginVersion").map { pluginVersion ->
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
Expand All @@ -81,60 +77,78 @@ intellijPlatform {
)
}
}

ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
}
}

signing {
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
privateKey = providers.environmentVariable("PRIVATE_KEY")
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
}

publishing {
//dependsOn("patchChangelog")
token = environment("PUBLISH_TOKEN")
token = providers.environmentVariable("PUBLISH_TOKEN")
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

signing {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
pluginVerification {
ides {
recommended()
}
}
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
groups.empty()
repositoryUrl = properties("pluginRepositoryUrl")
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
}

// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
koverReport {
defaults {
xml {
onCheck = true
kover {
reports {
total {
xml {
onCheck = true
}
}
}
}

tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()
gradleVersion = providers.gradleProperty("gradleVersion").get()
}

// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
intellijPlatformTesting.runIde.register("runIdeForUiTests") {
task {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
)
publishPlugin {
dependsOn(patchChangelog)
}
}

intellijPlatformTesting {
runIde {
register("runIdeForUiTests") {
task {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
)
}
}
}

plugins {
robotServerPlugin()
plugins {
robotServerPlugin()
}
}
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pluginRepositoryUrl = https://plugins.jetbrains.com/plugin/17450-ngtranslate-too

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 242
pluginSinceBuild = 233
pluginUntilBuild = 243.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#custom-target-platforms
Expand All @@ -22,7 +22,7 @@ platformPlugins =
platformBundledPlugins = JavaScript, AngularJS

# Java language level used to compile sources and to generate the files for - Java 17 is required since 2022.2
javaVersion = 21
# DELETE: javaVersion = 21

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.10.2
Expand Down
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
annotations = "24.1.0"

# plugins
kotlin = "1.9.23"
changelog = "2.2.0"
intelliJPlatformPlugin = "2.1.0"
qodana = "2023.3.1"
kover = "0.7.6"
kotlin = "1.9.25"
changelog = "2.2.1"
intelliJPlatform = "2.1.0"
qodana = "2024.2.3"
kover = "0.8.3"

[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intelliJPlatformPlugin = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatformPlugin" }
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}

rootProject.name = "idea-ngx-translate-autocomplete"

0 comments on commit 5f30463

Please sign in to comment.