ci: bump minor for breaking changes while pre-1.0, add version overri… #109
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: Test | |
| on: | |
| pull_request: | |
| # Also run on main so the Gradle cache is seeded on the default branch; | |
| # pull_request caches are scoped to their own PR and can't be shared. | |
| push: | |
| branches: [ main ] | |
| permissions: | |
| checks: write | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| # Caches Gradle distribution, dependencies, and build caches. | |
| # Writes only on main (default), so PR runs read without thrashing quota. | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Run detekt | |
| run: ./gradlew detekt --continue | |
| - name: Upload detekt reports | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: detekt-reports | |
| path: '**/build/reports/detekt/' | |
| - name: Run tests | |
| run: ./gradlew :kraft-ksp:jvmTest --continue | |
| # Real two-module KMP build: the consumer's converter only exists in the | |
| # producer's klib, so a green build proves cross-module @KraftConverter | |
| # discovery works under kspCommonMainKotlinMetadata (klib classpath). | |
| - name: KMP cross-module integration test | |
| run: ./gradlew :integration-tests:kmp-consumer:jvmTest :integration-tests:kmp-consumer:compileKotlinJs | |
| # Expected-failure counterpart: two producer klibs publish the same converter | |
| # pair, so the consumer's KSP run MUST fail with the classpath ambiguity error. | |
| # Asserts both the failure and the user-facing message. | |
| - name: KMP cross-module ambiguity error test | |
| run: | | |
| set +e | |
| out=$(./gradlew -PkraftAmbiguityFixture=true :integration-tests:kmp-consumer-ambiguous:kspCommonMainKotlinMetadata --console=plain 2>&1) | |
| status=$? | |
| set -e | |
| if [ "$status" -eq 0 ]; then | |
| echo "Expected the ambiguous-consumer build to fail, but it succeeded." | |
| exit 1 | |
| fi | |
| echo "$out" | grep -q "Ambiguous @KraftConverter on the classpath for (kotlin.Int → kotlin.String)" || { | |
| echo "Build failed but without the expected ambiguity message. Output tail:" | |
| echo "$out" | tail -40 | |
| exit 1 | |
| } | |
| - name: Publish test results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: kraft-ksp/build/reports/tests/jvmTest/ | |
| - name: Publish JUnit report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: always() | |
| with: | |
| report_paths: kraft-ksp/build/test-results/jvmTest/**/*.xml |