Skip to content

Commit 0a1dde1

Browse files
CopilotMte90
andauthored
Add CI workflow for Kotlin plugin builds with HasConvention diagnostics (#20)
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 7e3b124 commit 0a1dde1

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed

.github/workflows/kotlin-ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
permissions:
14+
contents: read
15+
strategy:
16+
matrix:
17+
java-version: [11, 17]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up JDK ${{ matrix.java-version }}
26+
uses: actions/setup-java@v4
27+
with:
28+
distribution: temurin
29+
java-version: ${{ matrix.java-version }}
30+
31+
- name: Cache Gradle
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
~/.gradle/caches
36+
~/.gradle/wrapper
37+
ide-plugins/.gradle
38+
key: gradle-${{ matrix.java-version }}-${{ hashFiles('ide-plugins/**/*.gradle*','ide-plugins/**/gradle-wrapper.properties') }}
39+
restore-keys: |
40+
gradle-${{ matrix.java-version }}-
41+
42+
- name: Make wrapper executable
43+
run: chmod +x ./gradlew
44+
working-directory: ide-plugins
45+
46+
- name: Print Gradle info (for debugging)
47+
run: ./gradlew --no-daemon --version
48+
working-directory: ide-plugins
49+
50+
- name: Run diagnostics script (prints wrapper and kotlin plugin references)
51+
run: |
52+
mkdir -p ../out
53+
./inspect_gradle_kotlin_versions.sh > ../out/ci-diagnostics.txt || true
54+
working-directory: ide-plugins
55+
- name: Upload diagnostics
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: ci-diagnostics-java-${{ matrix.java-version }}
59+
path: out/ci-diagnostics.txt
60+
61+
- name: Full build with stacktrace (capture to file)
62+
env:
63+
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g"
64+
run: |
65+
set -o pipefail
66+
./gradlew build --no-daemon --stacktrace 2>&1 | tee ../gradle-build.log || true
67+
working-directory: ide-plugins
68+
- name: Upload build log
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: gradle-build-log-java-${{ matrix.java-version }}
72+
path: gradle-build.log
73+
74+
- name: Build Kotlin plugin subproject if present
75+
run: |
76+
set -o pipefail
77+
if ./gradlew :kotlin:tasks --dry-run &>/dev/null; then
78+
echo "Detected :kotlin subproject -> building it"
79+
./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee ../kotlin-subproject-build.log || true
80+
echo "Uploading kotlin-subproject-build.log"
81+
ls -la ../kotlin-subproject-build.log || true
82+
elif ./gradlew :plugin:kotlin:tasks --dry-run &>/dev/null; then
83+
echo "Detected :plugin:kotlin subproject -> building it"
84+
./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee ../kotlin-subproject-build.log || true
85+
else
86+
echo "No explicit kotlin plugin subproject found; running assemble on all projects"
87+
./gradlew assemble --no-daemon --stacktrace 2>&1 | tee ../assemble.log || true
88+
fi
89+
working-directory: ide-plugins
90+
- name: Upload kotlin-subproject/build logs if present
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: kotlin-subproject-logs-java-${{ matrix.java-version }}
94+
path: |
95+
kotlin-subproject-build.log
96+
assemble.log
97+
if: always()
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)