Skip to content
Open
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
67 changes: 31 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
steps:

# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
large-packages: false

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

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

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v5
Expand All @@ -53,21 +53,6 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"

echo "version=$VERSION" >> $GITHUB_OUTPUT

echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Build plugin
- name: Build plugin
run: ./gradlew buildPlugin
Expand Down Expand Up @@ -97,6 +82,13 @@ jobs:
runs-on: ubuntu-latest
steps:

# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
large-packages: false

# Check out the current repository
- name: Fetch Sources
uses: actions/checkout@v5
Expand All @@ -111,6 +103,8 @@ jobs:
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: true

# Run tests
- name: Run Tests
Expand All @@ -133,7 +127,7 @@ jobs:

# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@main
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
large-packages: false
Expand All @@ -153,13 +147,6 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# We don't store the cache of the verify job, as it takes too much space.
# It contains each IntelliJ IDEA version we test against. These versions
# are stored in ~/.gradle/caches/*/transforms/*/*/ideaIC* and each takes about 3GB.
# Use "du -hs ~/.gradle/caches/*/transforms/*/*/ideaIC*" to verify.
# This would be part of the cache "gradle-transforms-v1-...".
# Also, the cache "gradle-dependencies-v1-..." is much bigger for verify job.
# In total, the new caches are bigger than 10GB, which are available on GitHub by default.
cache-read-only: true

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
Expand Down Expand Up @@ -189,6 +176,13 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@v5

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

# Remove old release drafts by using the curl request for the available releases with a draft flag
- name: Remove Old Release Drafts
env:
Expand All @@ -203,10 +197,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ needs.build.outputs.version }}" \
VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
RELEASE_NOTE="./build/tmp/release_note.txt"
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE

gh release create "v${VERSION}" \
--draft \
--title "v${{ needs.build.outputs.version }}" \
--notes "$(cat << 'EOM'
${{ needs.build.outputs.changelog }}
EOM
)"
--title "v${VERSION}" \
--notes-file "$RELEASE_NOTE"
45 changes: 22 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,43 @@ jobs:
pull-requests: write
steps:

# Setup Java 17 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v5
# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@v1.3.1
with:
distribution: zulu
java-version: 17
tool-cache: false
large-packages: false

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}

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

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
${{ github.event.release.body }}
EOM
)"

echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
with:
cache-read-only: true

# Update the Unreleased section with the current release note
- name: Patch Changelog
if: ${{ steps.properties.outputs.changelog != '' }}
if: ${{ github.event.release.body != '' }}
env:
CHANGELOG: ${{ steps.properties.outputs.changelog }}
CHANGELOG: ${{ github.event.release.body }}
run: |
./gradlew patchChangelog --release-note="$CHANGELOG"
RELEASE_NOTE="./build/tmp/release_note.txt"
mkdir -p "$(dirname "$RELEASE_NOTE")"
echo "$CHANGELOG" > $RELEASE_NOTE

./gradlew patchChangelog --release-note-file=$RELEASE_NOTE

# Publish the plugin to JetBrains Marketplace
- name: Publish Plugin
Expand All @@ -75,7 +74,7 @@ jobs:

# Create a pull request
- name: Create Pull Request
if: ${{ steps.properties.outputs.changelog != '' }}
if: ${{ github.event.release.body != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps:
# - Prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with the UI.
# - Wait for IDE to start.
# - Run UI tests with a separate Gradle task.
#
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform.
#
# Workflow is triggered manually.

name: Run UI Tests
on:
workflow_dispatch

jobs:

testUI:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
runIde: |
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x16 &
gradle runIdeForUiTests &
- os: windows-latest
runIde: start gradlew.bat runIdeForUiTests
- os: macos-latest
runIde: ./gradlew runIdeForUiTests &

steps:

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

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

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
cache-read-only: true

# Run IDEA prepared for UI testing
- name: Run IDE
run: ${{ matrix.runIde }}

# Wait for IDEA to be started
- name: Health Check
uses: jtalk/url-health-check-action@v4
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s

# Run tests
- name: Tests
run: ./gradlew test
25 changes: 11 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugins {
alias(libs.plugins.changelog) // Gradle Changelog Plugin
}

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

// Set the JVM language level used to build the project.
Expand All @@ -21,36 +22,35 @@ kotlin {
// Configure project's dependencies
repositories {
mavenCentral()

// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
intellijPlatform() {
defaultRepositories()
}
}

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

implementation(libs.bundles.pmd) {
// Prevent conflict with IntelliJ's slf4j which results in a LinkageError
exclude("org.slf4j", module = "slf4j-api")
}

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 {
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#setting-up-intellij-platform
// local("/Users/user/Applications/IntelliJ IDEA Ultimate.app")
// for EAP
val platformVersion = providers.gradleProperty("platformVersion").get()
val useInstaller = !platformVersion.endsWith("-EAP-SNAPSHOT")
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"), useInstaller = useInstaller)
intellijIdea(providers.gradleProperty("platformVersion"))

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

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

pluginVerifier()
zipSigner()
// Module Dependencies. Uses `platformBundledModules` property from the gradle.properties file for bundled IntelliJ Platform modules.
bundledModules(providers.gradleProperty("platformBundledModules").map { it.split(',') })

testFramework(TestFrameworkType.Platform)
}
}
Expand Down Expand Up @@ -89,7 +89,6 @@ intellijPlatform {

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

Expand All @@ -109,8 +108,6 @@ intellijPlatform {

pluginVerification {
ides {
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification-ides
// recommended() automatically tests based on the current platformVersion
recommended()
}
}
Expand Down
12 changes: 4 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
# IntelliJ Platform Artifacts Repositories
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html

pluginGroup = com.intellij.plugins.bodhi.pmd
pluginName = PMD
pluginRepositoryUrl = https://github.com/amitdev/PMD-Intellij
# SemVer format -> https://semver.org
pluginVersion = 2.1.2

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 241
# no upper bound for the version range -> see https://github.com/amitdev/PMD-Intellij/issues/213
pluginUntilBuild =

platformType = IU
# https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#multipleIDEVersions
# When supporting multiple major versions, it is strongly recommended to build against
# the _lowest_ supported version to guarantee backwards-compatibility.
platformVersion = 2025.2
#platformVersion = 251-EAP-SNAPSHOT
#platformVersion = 2025.1
org.jetbrains.intellij.platform.downloadSources=true

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins = com.intellij.java,org.jetbrains.kotlin
# Example: platformBundledModules = intellij.spellchecker
platformBundledModules =

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.14.2
Expand Down
Loading