feat: add Environment interface #1926
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
| # Builds and tests the Kotlin ADK with Gradle on the supported JDKs. | |
| name: validation | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-modules: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| java-version: ["17", "21", "25"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| # JDK 21 is required by the litertlm/examples module toolchains (the | |
| # upstream litert-lm artifacts are compiled for Java 21). The matrix JDK | |
| # is used for the rest of the project; the last version listed becomes | |
| # JAVA_HOME, so Gradle starts up on the matrix JDK. | |
| - name: Set up JDK 21 and JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: | | |
| 21 | |
| ${{ matrix.java-version }} | |
| # The `com.android.library` subprojects need an SDK to resolve | |
| # compileSdk / minSdk. Installed explicitly to pin the components. | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v4 | |
| with: | |
| # Keep these in sync with the values in build.gradle.kts | |
| # (androidCompileSdk / androidMinSdk). | |
| packages: "platforms;android-36 build-tools;36.0.0" | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/libs.versions.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle-${{ matrix.java-version }}- | |
| ${{ runner.os }}-gradle- | |
| - name: Build and test (Java ${{ matrix.java-version }}) | |
| # `gradle.properties` is tuned for local/corp dev machines and sets | |
| # heap sizes (Xmx16g for Gradle, Xmx32g for the Kotlin daemon) that | |
| # exceed the ~16 GB available on GitHub-hosted `ubuntu-latest` runners. | |
| # We override them here so CI does not OOM at daemon startup. | |
| env: | |
| GRADLE_OPTS: "-Xmx4g -XX:MaxMetaspaceSize=1g -Dorg.gradle.daemon=false" | |
| FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }} | |
| FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }} | |
| FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} | |
| FIREBASE_DISABLE_IT: ${{ vars.FIREBASE_DISABLE_IT }} | |
| FIREBASE_MODEL_NAME: ${{ vars.FIREBASE_MODEL_NAME }} | |
| run: | | |
| ./gradlew \ | |
| -PjdkVersion=${{ matrix.java-version }} \ | |
| -Pkotlin.daemon.jvmargs="-Xmx4g" \ | |
| --no-daemon \ | |
| --stacktrace \ | |
| build | |
| - name: Detect wrongly formatted files | |
| run: git status && git diff --exit-code |