diff --git a/.github/workflows/intellij-plugin.yml b/.github/workflows/intellij-plugin.yml new file mode 100644 index 0000000..55f9776 --- /dev/null +++ b/.github/workflows/intellij-plugin.yml @@ -0,0 +1,115 @@ +name: IntelliJ Plugin + +on: + push: + branches: [ main ] + paths: + - 'compose-stability-analyzer-idea/**' + - '.github/workflows/intellij-plugin.yml' + pull_request: + branches: [ '*' ] + paths: + - 'compose-stability-analyzer-idea/**' + - '.github/workflows/intellij-plugin.yml' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-plugin: + name: Build IntelliJ Plugin + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build stability-runtime (dependency) + run: ./gradlew :stability-runtime:build --no-daemon --stacktrace + + - name: Build IntelliJ plugin + run: ./gradlew :compose-stability-analyzer-idea:buildPlugin --no-daemon --stacktrace + + - name: Upload plugin distribution + uses: actions/upload-artifact@v4 + with: + name: intellij-plugin + path: compose-stability-analyzer-idea/build/distributions/*.zip + + test-plugin: + name: Test IntelliJ Plugin + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build stability-runtime (dependency) + run: ./gradlew :stability-runtime:build --no-daemon --stacktrace + + - name: Run plugin tests + run: ./gradlew :compose-stability-analyzer-idea:test --no-daemon --stacktrace + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: plugin-test-results + path: compose-stability-analyzer-idea/build/reports/tests/ + + publish-check: + name: Plugin Publish Check + runs-on: ubuntu-latest + needs: [build-plugin, test-plugin] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build stability-runtime (dependency) + run: ./gradlew :stability-runtime:build --no-daemon --stacktrace + + - name: Build and verify plugin + run: | + ./gradlew :compose-stability-analyzer-idea:buildPlugin \ + --no-daemon --stacktrace + + - name: Display plugin info + run: | + echo "Plugin built successfully" + ls -lh compose-stability-analyzer-idea/build/distributions/ + + - name: Verify plugin structure + run: | + cd compose-stability-analyzer-idea/build/distributions + unzip -l *.zip | head -50 diff --git a/.github/workflows/module-tests.yml b/.github/workflows/module-tests.yml new file mode 100644 index 0000000..9727c81 --- /dev/null +++ b/.github/workflows/module-tests.yml @@ -0,0 +1,162 @@ +name: Module Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ '*' ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + compiler-plugin-tests: + name: Compiler Plugin Tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build stability-compiler + run: ./gradlew :stability-compiler:build --no-daemon --stacktrace + + - name: Run stability-compiler tests + run: ./gradlew :stability-compiler:test --no-daemon --stacktrace + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: compiler-test-results + path: stability-compiler/build/reports/tests/ + + compiler-tests: + name: Compiler Tests (FIR/IR Dumps) + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build compiler-tests + run: ./gradlew :compiler-tests:build --no-daemon --stacktrace + + - name: Run compiler-tests + run: ./gradlew :compiler-tests:test --no-daemon --stacktrace + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: compiler-tests-results + path: compiler-tests/build/reports/tests/ + + runtime-tests: + name: Runtime Module Tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build stability-runtime + run: ./gradlew :stability-runtime:build --no-daemon --stacktrace + + - name: Run JVM tests + run: ./gradlew :stability-runtime:jvmTest --no-daemon --stacktrace + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: runtime-test-results + path: stability-runtime/build/reports/tests/ + + gradle-plugin-tests: + name: Gradle Plugin Tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build stability-gradle + run: ./gradlew :stability-gradle:build --no-daemon --stacktrace + + - name: Run stability-gradle tests + run: ./gradlew :stability-gradle:test --no-daemon --stacktrace + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: gradle-plugin-test-results + path: stability-gradle/build/reports/tests/ + + lint-tests: + name: Lint Module Tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build stability-lint + run: ./gradlew :stability-lint:build --no-daemon --stacktrace + + - name: Run stability-lint tests + run: ./gradlew :stability-lint:test --no-daemon --stacktrace + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: lint-test-results + path: stability-lint/build/reports/tests/ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5f3f33b..b33d07e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -27,6 +27,7 @@ androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "u junit = { module = "junit:junit", version.ref = "junit" } kotlin-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" } kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxCollectionsImmutable" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } lint-tests = { module = "com.android.tools.lint:lint-tests", version.ref = "lintApi" } lint = { module = "com.android.tools.lint:lint", version.ref = "lintApi" } lint-checks = { module = "com.android.tools.lint:lint-checks", version.ref = "lintApi" } diff --git a/stability-compiler/build.gradle.kts b/stability-compiler/build.gradle.kts index b996778..229e4eb 100644 --- a/stability-compiler/build.gradle.kts +++ b/stability-compiler/build.gradle.kts @@ -27,16 +27,13 @@ kotlin { } dependencies { + compileOnly(libs.kotlin.stdlib) compileOnly(libs.kotlin.compiler.embeddable) - compileOnly(libs.androidx.compose.compiler) api(project(":stability-runtime")) - // Test dependencies testImplementation(kotlin("test")) testImplementation(kotlin("test-junit")) testImplementation(libs.kotlin.compiler.embeddable) - testImplementation(libs.androidx.compose.compiler) - testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.6.0") testRuntimeOnly(kotlin("compiler")) testImplementation(kotlin("reflect"))