Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

CI Workflow for Kotlin Plugin Build

This PR adds a comprehensive GitHub Actions workflow to build and test the Kotlin plugin on every PR commit, along with diagnostic tools to investigate the Gradle error (org/gradle/api/internal/HasConvention) that appears in CI logs.

Changes Made

Created .github/workflows/kotlin-ci.yml workflow that:

  • Runs on pull requests (opened, synchronize, reopened) and pushes to main
  • Tests with Java 11 and 17 in a matrix build
  • Caches Gradle dependencies for faster builds
  • Prints Gradle version for debugging
  • Captures full build logs with stacktrace to a file
  • Uploads build logs as artifacts for inspection
  • Attempts to build Kotlin plugin subprojects
  • Includes explicit permissions for security (contents: read)
  • Runs all Gradle commands from the ide-plugins directory where gradlew is located
  • Uses unique artifact names per Java version to avoid conflicts

Created ide-plugins/inspect_gradle_kotlin_versions.sh diagnostic script that:

  • Prints Gradle wrapper distribution URL
  • Lists Kotlin Gradle plugin versions in build files
  • Searches for kotlin-gradle-plugin and org.jetbrains.kotlin references
  • Outputs gradle.properties and settings files
  • Made executable with proper permissions
  • Located in the ide-plugins folder for better organization

Fixed YAML syntax and security issues:

  • Quoted workflow name to handle em dash character
  • Quoted job name to handle templating syntax
  • Fixed artifact upload path specification
  • Added explicit permissions block for GITHUB_TOKEN
  • Fixed gradlew path issue by adding working-directory: ide-plugins to all Gradle steps
  • Fixed artifact name conflicts by including Java version in artifact names

Goals

This workflow helps capture the HasConvention failure details by:

  1. Running builds with full stacktraces
  2. Capturing all output to log files
  3. Uploading logs as artifacts for offline analysis
  4. Running diagnostic checks to identify version mismatches

Request to Maintainers

⚠️ If the CI fails with the HasConvention error, please check the uploaded artifacts:

  • gradle-build-log-java-11 / gradle-build-log-java-17 - Full build output with stacktraces
  • ci-diagnostics-java-11 / ci-diagnostics-java-17 - Gradle and Kotlin version information
  • kotlin-subproject-logs-java-11 / kotlin-subproject-logs-java-17 - Subproject-specific build logs

These artifacts will help identify the root cause of the Gradle API compatibility issue and provide the diagnostic information needed to fix it.

Files Added

  • .github/workflows/kotlin-ci.yml
  • ide-plugins/inspect_gradle_kotlin_versions.sh (moved from scripts/ci/)

Security Summary

✅ All CodeQL security checks passed with no vulnerabilities found.

Original prompt

Create a pull request that adds a GitHub Actions workflow to build the Kotlin plugin on every commit pushed to a PR and includes diagnostic steps to investigate the Gradle error shown in CI logs (org/gradle/api/internal/HasConvention). The PR should be created on a new branch named ci/add-kotlin-plugin-ci-and-diagnostics.

Objectives (high level):

  • Add .github/workflows/kotlin-ci.yml that runs on pull_request (opened, synchronize, reopened) and on push to main. The job should run on ubuntu-latest with a Java matrix (11 and 17), cache Gradle, make the wrapper executable, print Gradle info, run a full build with --stacktrace and capture logs, attempt to build common kotlin plugin subprojects, and upload the build log as an artifact for inspection.
  • Add a small diagnostic script at scripts/ci/inspect_gradle_kotlin_versions.sh that prints the Gradle wrapper distribution URL, lists the Kotlin Gradle plugin versions referenced in repository build files (search for kotlin-gradle-plugin and org.jetbrains.kotlin), and prints relevant gradle.properties and settings files. Make the script executable and have the workflow run it and upload its output as an artifact.
  • The workflow should run ./gradlew build --no-daemon --stacktrace and redirect stdout/stderr to a file (gradle-build.log) which is uploaded as an artifact so CI logs are preserved for the investigation.

Files to add (exact contents):

File: .github/workflows/kotlin-ci.yml

name: CI — Build Kotlin plugin on PR commits

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [ "main" ]

jobs:
build-kotlin-plugin:
name: Build (matrix: Java ${{ matrix.java-version }})
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [11, 17]

steps:
  - name: Checkout repository
    uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - name: Set up JDK ${{ matrix.java-version }}
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: ${{ matrix.java-version }}

  - name: Cache Gradle
    uses: actions/cache@v4
    with:
      path: |
        ~/.gradle/caches
        ~/.gradle/wrapper
        .gradle
      key: gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*','**/gradle-wrapper.properties') }}
      restore-keys: |
        gradle-${{ matrix.java-version }}-

  - name: Make wrapper executable
    run: chmod +x ./gradlew

  - name: Print Gradle info (for debugging)
    run: ./gradlew --no-daemon --version

  - name: Run diagnostics script (prints wrapper and kotlin plugin references)
    run: |
      mkdir -p out
      scripts/ci/inspect_gradle_kotlin_versions.sh > out/ci-diagnostics.txt || true
  - name: Upload diagnostics
    uses: actions/upload-artifact@v4
    with:
      name: ci-diagnostics
      path: out/ci-diagnostics.txt

  - name: Full build with stacktrace (capture to file)
    env:
      GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g"
    run: |
      set -o pipefail
      ./gradlew build --no-daemon --stacktrace 2>&1 | tee gradle-build.log || true
  - name: Upload build log
    uses: actions/upload-artifact@v4
    with:
      name: gradle-build-log
      path: gradle-build.log

  - name: Build Kotlin plugin subproject if present
    run: |
      set -o pipefail
      if ./gradlew :kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :kotlin subproject -> building it"
        ./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
        echo "Uploading kotlin-subproject-build.log"
        ls -la kotlin-subproject-build.log || true
      elif ./gradlew :plugin:kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :plugin:kotlin subproject -> building it"
        ./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
      else
        echo "No explicit kotlin plugin subproject found; running assemble on all projects"
        ./gradlew assemble --no-daemon --stacktrace 2>&1 | tee assemble.log || true
      fi
  - name: Upload kotlin-subproject/build logs if present
    uses: actions/upload-artifact@v4
    with:
      name: kotlin-subproject-logs
      path: |
        kotlin-subproject-build.log
        assemble.log
        || true

File: scripts/ci/inspect_gradle_kotlin_versions.sh

#!/usr/bin/env bash
set -eu

Print Gradle wrapper distribution URL

if [ -f gradle/wrapper/gradle-wrapper.properties ]; then
echo "== gradle-wrapper.properties =="
grep -i distributionUrl gradle/wrapper/gradle-wrapper.properties || true
echo
fi

Print gradle.properties if present

if [ -f gradle.properties ]; then
echo "== gradle.properties =="
cat gradle.properties || true
echo
fi

S...

This pull request was created as a result of the following prompt from Copilot chat.

Create a pull request that adds a GitHub Actions workflow to build the Kotlin plugin on every commit pushed to a PR and includes diagnostic steps to investigate the Gradle error shown in CI logs (org/gradle/api/internal/HasConvention). The PR should be created on a new branch named ci/add-kotlin-plugin-ci-and-diagnostics.

Objectives (high level):

  • Add .github/workflows/kotlin-ci.yml that runs on pull_request (opened, synchronize, reopened) and on push to main. The job should run on ubuntu-latest with a Java matrix (11 and 17), cache Gradle, make the wrapper executable, print Gradle info, run a full build with --stacktrace and capture logs, attempt to build common kotlin plugin subprojects, and upload the build log as an artifact for inspection.
  • Add a small diagnostic script at scripts/ci/inspect_gradle_kotlin_versions.sh that prints the Gradle wrapper distribution URL, lists the Kotlin Gradle plugin versions referenced in repository build files (search for kotlin-gradle-plugin and org.jetbrains.kotlin), and prints relevant gradle.properties and settings files. Make the script executable and have the workflow run it and upload its output as an artifact.
  • The workflow should run ./gradlew build --no-daemon --stacktrace and redirect stdout/stderr to a file (gradle-build.log) which is uploaded as an artifact so CI logs are preserved for the investigation.

Files to add (exact contents):

File: .github/workflows/kotlin-ci.yml

name: CI — Build Kotlin plugin on PR commits

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [ "main" ]

jobs:
build-kotlin-plugin:
name: Build (matrix: Java ${{ matrix.java-version }})
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [11, 17]

steps:
  - name: Checkout repository
    uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - name: Set up JDK ${{ matrix.java-version }}
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: ${{ matrix.java-version }}

  - name: Cache Gradle
    uses: actions/cache@v4
    with:
      path: |
        ~/.gradle/caches
        ~/.gradle/wrapper
        .gradle
      key: gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*','**/gradle-wrapper.properties') }}
      restore-keys: |
        gradle-${{ matrix.java-version }}-

  - name: Make wrapper executable
    run: chmod +x ./gradlew

  - name: Print Gradle info (for debugging)
    run: ./gradlew --no-daemon --version

  - name: Run diagnostics script (prints wrapper and kotlin plugin references)
    run: |
      mkdir -p out
      scripts/ci/inspect_gradle_kotlin_versions.sh > out/ci-diagnostics.txt || true
  - name: Upload diagnostics
    uses: actions/upload-artifact@v4
    with:
      name: ci-diagnostics
      path: out/ci-diagnostics.txt

  - name: Full build with stacktrace (capture to file)
    env:
      GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g"
    run: |
      set -o pipefail
      ./gradlew build --no-daemon --stacktrace 2>&1 | tee gradle-build.log || true
  - name: Upload build log
    uses: actions/upload-artifact@v4
    with:
      name: gradle-build-log
      path: gradle-build.log

  - name: Build Kotlin plugin subproject if present
    run: |
      set -o pipefail
      if ./gradlew :kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :kotlin subproject -> building it"
        ./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
        echo "Uploading kotlin-subproject-build.log"
        ls -la kotlin-subproject-build.log || true
      elif ./gradlew :plugin:kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :plugin:kotlin subproject -> building it"
        ./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
      else
        echo "No explicit kotlin plugin subproject found; running assemble on all projects"
        ./gradlew assemble --no-daemon --stacktrace 2>&1 | tee assemble.log || true
      fi
  - name: Upload kotlin-subproject/build logs if present
    uses: actions/upload-artifact@v4
    with:
      name: kotlin-subproject-logs
      path: |
        kotlin-subproject-build.log
        assemble.log
        || true

File: scripts/ci/inspect_gradle_kotlin_versions.sh

#!/usr/bin/env bash
set -eu

Print Gradle wrapper distribution URL

if [ -f gradle/wrapper/gradle-wrapper.properties ]; then
echo "== gradle-wrapper.properties =="
grep -i distributionUrl gradle/wrapper/gradle-wrapper.properties || true
echo
fi

Print gradle.properties if present

if [ -f gradle.properties ]; then
echo "== gradle.properties =="
cat gradle.properties || true
echo
fi

Search for Kotlin Gradle plugin references

echo "== Kotlin plugin references (searching for kotlin-gradle-plugin and org.jetbrains.kotlin) =="
grep -R --line-number --color=never "kotlin-gradle-plugin" || true
grep -R --line-number --color=never "org.jetbrains.kotlin" || true

Print build.gradle(.kts) files header lines to show plugin versions where declared

for f in $(git ls-files ".gradle" ".gradle.kts" 2>/dev/null || true); do
echo "---- $f ----"
sed -n '1,200p' "$f" | sed -n '1,60p'
echo
done

Print settings.gradle(.kts)

for f in $(git ls-files "settings.gradle" "settings.gradle.kts" 2>/dev/null || true); do
echo "---- $f ----"
sed -n '1,200p' "$f" | sed -n '1,60p'
echo
done

Print the kotlin plugin versions extracted via a rough regex

echo "== Extracted candidate versions =="
grep -R --line-number --color=never "kotlin-gradle-plugin[:=][^\n]*" || true

Make the script executable and ensure workflow runs it as shown above.

Success condition:

  • A PR is opened on a branch ci/add-kotlin-plugin-ci-and-diagnostics containing the new workflow and diagnostic script. The workflow should run on PR commits. The PR description should explain the goals and how the workflow helps capture the HasConvention failure details, and request maintainers to look at the uploaded artifacts if the CI fails.

Please create the PR and return the PR URL and a short summary of actions performed.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits November 11, 2025 16:01
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions workflow for Kotlin plugin CI and diagnostics Add CI workflow for Kotlin plugin builds with HasConvention diagnostics Nov 11, 2025
Copilot AI requested a review from Mte90 November 11, 2025 16:17
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
@Mte90
Copy link
Member

Mte90 commented Nov 11, 2025

@copilot the action java 17 fails with Run chmod +x ./gradlew
chmod: cannot access './gradlew': No such file or directory
Error: Process completed with exit code 1.

Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot the action java 17 fails with Run chmod +x ./gradlew
chmod: cannot access './gradlew': No such file or directory
Error: Process completed with exit code 1.

Fixed! The gradlew file is located in ide-plugins/, not the repository root. Updated all Gradle steps to use working-directory: ide-plugins so they run from the correct directory. (commit 256a960)

@Mte90
Copy link
Member

Mte90 commented Nov 11, 2025

@copilot Run actions/upload-artifact@v4
With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

same ci

Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot Run actions/upload-artifact@v4
With the provided path, there will be 1 file uploaded
Artifact name is valid!...

Fixed! The artifact names now include the Java version (-java-${{ matrix.java-version }}) to make them unique for each matrix job. Artifacts will now be named ci-diagnostics-java-11, gradle-build-log-java-17, etc. (commit 802b706)

@Mte90 Mte90 marked this pull request as ready for review November 11, 2025 17:29
@Mte90 Mte90 merged commit 0a1dde1 into master Nov 11, 2025
2 checks passed
@Mte90 Mte90 deleted the copilot/ciadd-kotlin-plugin-ci-and-diagnostics branch November 11, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants