|
| 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() |
0 commit comments