Add CI workflow and diagnostics script #13
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||