Skip to content

Commit d0f0cfb

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

File tree

2 files changed

+54
-22
lines changed

2 files changed

+54
-22
lines changed

.github/workflows/kotlin-ci.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'CI — Build Kotlin plugin on PR commits'
1+
name: CI — Build Kotlin plugin on PR commits
22

33
on:
44
pull_request:
@@ -8,10 +8,8 @@ on:
88

99
jobs:
1010
build-kotlin-plugin:
11-
name: 'Build (matrix: Java ${{ matrix.java-version }})'
11+
name: Build (matrix: Java ${{ matrix.java-version }})
1212
runs-on: ubuntu-latest
13-
permissions:
14-
contents: read
1513
strategy:
1614
matrix:
1715
java-version: [11, 17]
@@ -34,64 +32,59 @@ jobs:
3432
path: |
3533
~/.gradle/caches
3634
~/.gradle/wrapper
37-
ide-plugins/.gradle
38-
key: gradle-${{ matrix.java-version }}-${{ hashFiles('ide-plugins/**/*.gradle*','ide-plugins/**/gradle-wrapper.properties') }}
35+
.gradle
36+
key: gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*','**/gradle-wrapper.properties') }}
3937
restore-keys: |
4038
gradle-${{ matrix.java-version }}-
4139
4240
- name: Make wrapper executable
4341
run: chmod +x ./gradlew
44-
working-directory: ide-plugins
4542

4643
- name: Print Gradle info (for debugging)
4744
run: ./gradlew --no-daemon --version
48-
working-directory: ide-plugins
4945

5046
- name: Run diagnostics script (prints wrapper and kotlin plugin references)
5147
run: |
52-
mkdir -p ../out
53-
./inspect_gradle_kotlin_versions.sh > ../out/ci-diagnostics.txt || true
54-
working-directory: ide-plugins
48+
mkdir -p out
49+
scripts/ci/inspect_gradle_kotlin_versions.sh > out/ci-diagnostics.txt || true
5550
- name: Upload diagnostics
5651
uses: actions/upload-artifact@v4
5752
with:
58-
name: ci-diagnostics-java-${{ matrix.java-version }}
53+
name: ci-diagnostics
5954
path: out/ci-diagnostics.txt
6055

6156
- name: Full build with stacktrace (capture to file)
6257
env:
6358
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g"
6459
run: |
6560
set -o pipefail
66-
./gradlew build --no-daemon --stacktrace 2>&1 | tee ../gradle-build.log || true
67-
working-directory: ide-plugins
61+
./gradlew build --no-daemon --stacktrace 2>&1 | tee gradle-build.log || true
6862
- name: Upload build log
6963
uses: actions/upload-artifact@v4
7064
with:
71-
name: gradle-build-log-java-${{ matrix.java-version }}
65+
name: gradle-build-log
7266
path: gradle-build.log
7367

7468
- name: Build Kotlin plugin subproject if present
7569
run: |
7670
set -o pipefail
7771
if ./gradlew :kotlin:tasks --dry-run &>/dev/null; then
7872
echo "Detected :kotlin subproject -> building it"
79-
./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee ../kotlin-subproject-build.log || true
73+
./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
8074
echo "Uploading kotlin-subproject-build.log"
81-
ls -la ../kotlin-subproject-build.log || true
75+
ls -la kotlin-subproject-build.log || true
8276
elif ./gradlew :plugin:kotlin:tasks --dry-run &>/dev/null; then
8377
echo "Detected :plugin:kotlin subproject -> building it"
84-
./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee ../kotlin-subproject-build.log || true
78+
./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
8579
else
8680
echo "No explicit kotlin plugin subproject found; running assemble on all projects"
87-
./gradlew assemble --no-daemon --stacktrace 2>&1 | tee ../assemble.log || true
81+
./gradlew assemble --no-daemon --stacktrace 2>&1 | tee assemble.log || true
8882
fi
89-
working-directory: ide-plugins
9083
- name: Upload kotlin-subproject/build logs if present
9184
uses: actions/upload-artifact@v4
9285
with:
93-
name: kotlin-subproject-logs-java-${{ matrix.java-version }}
86+
name: kotlin-subproject-logs
9487
path: |
9588
kotlin-subproject-build.log
9689
assemble.log
97-
if: always()
90+
|| 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 gradle/wrapper/gradle-wrapper.properties ]; then
6+
echo "== gradle-wrapper.properties =="
7+
grep -i distributionUrl gradle/wrapper/gradle-wrapper.properties || true
8+
echo
9+
fi
10+
11+
# Print gradle.properties if present
12+
if [ -f gradle.properties ]; then
13+
echo "== gradle.properties =="
14+
cat 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" || true
21+
grep -R --line-number --color=never "org.jetbrains.kotlin" || true
22+
23+
# Print build.gradle(.kts) files header lines to show plugin versions where declared
24+
for f in $(git ls-files "*.gradle" "*.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 "settings.gradle" "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]*" || true

0 commit comments

Comments
 (0)