diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbed76a..616ea8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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<> $GITHUB_OUTPUT - echo "$CHANGELOG" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - # Build plugin - name: Build plugin run: ./gradlew buildPlugin @@ -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 @@ -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 @@ -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 @@ -152,13 +146,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 @@ -188,6 +175,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: @@ -202,10 +196,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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c275a92..34311bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,12 +19,12 @@ 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 @@ -32,31 +32,30 @@ jobs: 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<> $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 @@ -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: | diff --git a/.github/workflows/run-ui-tests.yml b/.github/workflows/run-ui-tests.yml new file mode 100644 index 0000000..dca12a7 --- /dev/null +++ b/.github/workflows/run-ui-tests.yml @@ -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 diff --git a/build.gradle.kts b/build.gradle.kts index 0bd27e6..9fd450d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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. @@ -21,27 +22,25 @@ 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(',') }) @@ -49,8 +48,9 @@ dependencies { // 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) } } @@ -89,7 +89,6 @@ intellijPlatform { ideaVersion { sinceBuild = providers.gradleProperty("pluginSinceBuild") - untilBuild = providers.gradleProperty("pluginUtilBuild") } } @@ -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() } } diff --git a/gradle.properties b/gradle.properties index 3d81a40..107308a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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.0 -# 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 = 9.3.1