Skip to content

Commit 777e688

Browse files
CopilotMte90
andcommitted
Add Kotlin CI workflow and diagnostics script
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
1 parent c23ee16 commit 777e688

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

.github/workflows/kotlin-ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: "CI — Build Kotlin plugin on PR commits"
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build-kotlin-plugin:
11+
name: "Build (matrix: Java ${{ matrix.java-version }})"
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
java-version: [11, 17]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up JDK ${{ matrix.java-version }}
24+
uses: actions/setup-java@v4
25+
with:
26+
distribution: temurin
27+
java-version: ${{ matrix.java-version }}
28+
29+
- name: Cache Gradle
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.gradle/caches
34+
~/.gradle/wrapper
35+
.gradle
36+
key: gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*','**/gradle-wrapper.properties') }}
37+
restore-keys: |
38+
gradle-${{ matrix.java-version }}-
39+
40+
- name: Make wrapper executable
41+
run: chmod +x ide-plugins/gradlew
42+
43+
- name: Print Gradle info (for debugging)
44+
working-directory: ide-plugins
45+
run: ./gradlew --no-daemon --version
46+
47+
- name: Run diagnostics script (prints wrapper and kotlin plugin references)
48+
run: |
49+
mkdir -p out
50+
scripts/ci/inspect_gradle_kotlin_versions.sh > out/ci-diagnostics.txt || true
51+
- name: Upload diagnostics
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: ci-diagnostics
55+
path: out/ci-diagnostics.txt
56+
57+
- name: Full build with stacktrace (capture to file)
58+
working-directory: ide-plugins
59+
env:
60+
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g"
61+
run: |
62+
set -o pipefail
63+
./gradlew build --no-daemon --stacktrace 2>&1 | tee gradle-build.log || true
64+
- name: Upload build log
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: gradle-build-log
68+
path: ide-plugins/gradle-build.log
69+
70+
- name: Build Kotlin plugin subproject if present
71+
working-directory: ide-plugins
72+
run: |
73+
set -o pipefail
74+
if ./gradlew :kotlin:tasks --dry-run &>/dev/null; then
75+
echo "Detected :kotlin subproject -> building it"
76+
./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
77+
echo "Uploading kotlin-subproject-build.log"
78+
ls -la kotlin-subproject-build.log || true
79+
elif ./gradlew :plugin:kotlin:tasks --dry-run &>/dev/null; then
80+
echo "Detected :plugin:kotlin subproject -> building it"
81+
./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
82+
else
83+
echo "No explicit kotlin plugin subproject found; running assemble on all projects"
84+
./gradlew assemble --no-daemon --stacktrace 2>&1 | tee assemble.log || true
85+
fi
86+
- name: Upload kotlin-subproject/build logs if present
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: kotlin-subproject-logs
90+
path: |
91+
ide-plugins/kotlin-subproject-build.log
92+
ide-plugins/assemble.log
93+
|| true
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
# Print Gradle wrapper distribution URL
5+
if [ -f ide-plugins/gradle/wrapper/gradle-wrapper.properties ]; then
6+
echo "== gradle-wrapper.properties =="
7+
grep -i distributionUrl ide-plugins/gradle/wrapper/gradle-wrapper.properties || true
8+
echo
9+
fi
10+
11+
# Print gradle.properties if present
12+
if [ -f ide-plugins/gradle.properties ]; then
13+
echo "== gradle.properties =="
14+
cat ide-plugins/gradle.properties || true
15+
echo
16+
fi
17+
18+
# Search for Kotlin Gradle plugin references
19+
echo "== Kotlin plugin references (searching for kotlin-gradle-plugin and org.jetbrains.kotlin) =="
20+
grep -R --line-number --color=never "kotlin-gradle-plugin" ide-plugins/ || true
21+
grep -R --line-number --color=never "org.jetbrains.kotlin" ide-plugins/ || true
22+
23+
# Print build.gradle(.kts) files header lines to show plugin versions where declared
24+
for f in $(git ls-files "ide-plugins/*.gradle" "ide-plugins/*.gradle.kts" 2>/dev/null || true); do
25+
echo "---- $f ----"
26+
sed -n '1,200p' "$f" | sed -n '1,60p'
27+
echo
28+
done
29+
30+
# Print settings.gradle(.kts)
31+
for f in $(git ls-files "ide-plugins/settings.gradle" "ide-plugins/settings.gradle.kts" 2>/dev/null || true); do
32+
echo "---- $f ----"
33+
sed -n '1,200p' "$f" | sed -n '1,60p'
34+
echo
35+
done
36+
37+
# Print the kotlin plugin versions extracted via a rough regex
38+
echo "== Extracted candidate versions =="
39+
grep -R --line-number --color=never "kotlin-gradle-plugin[:=][^\n]*" ide-plugins/ || true

0 commit comments

Comments
 (0)