| name: 'build-single-playground-project' |
| description: 'Builds one playground project based on inputs' |
| inputs: |
| project: |
| description: "Name of the project (used for artifacts)" |
| required: true |
| project-root: |
| description: "Root folder of the project (used for building)" |
| required: true |
| gradle-cache-password: |
| description: "password for gradle cache" |
| gradle-enterprise-access-key: |
| description: "access key for gradle enterprise" |
| gradle-encryption-key: |
| description: "key for gradle configuration cache encryption" |
| gradle-flags: |
| description: "flags to pass while invoking gradle" |
| runs: |
| using: "composite" |
| steps: |
| - name: "Setup JDK 17 and 21" |
| id: setup-java |
| uses: actions/setup-java@v4 |
| with: |
| distribution: "zulu" |
| java-version: | |
| 17 |
| 21 |
| # TODO b/216535050: Implement task to install the exact AndroidX ndk |
| # version in case it is not available. |
| - name: "Install Cmake" |
| shell: bash |
| run: echo "yes" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "cmake;3.22.1" |
| - name: "Install NDK" |
| working-directory: ${{ github.workspace }} |
| shell: bash |
| run: | |
| set -x |
| NDK_VERSION=$(grep "ndkVersion" buildSrc/ndk.gradle | awk -F "=" '{gsub(/"| /, ""); print $2}') |
| echo "yes" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "ndk;$NDK_VERSION" |
| - name: "Install Android SDK Build-Tools" |
| shell: bash |
| run: echo "yes" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "build-tools;35.0.0-rc1" |
| - name: "Set environment variables" |
| shell: bash |
| run: | |
| set -x |
| echo "DIST_DIR=$HOME/dist" >> $GITHUB_ENV |
| |
| - name: "Setup Gradle" |
| uses: gradle/gradle-build-action@v3-beta |
| with: |
| # Only save Gradle User Home state for builds on the 'androidx-main' branch. |
| # Builds on other branches will only read existing entries from the cache. |
| cache-read-only: ${{ github.ref != 'refs/heads/androidx-main' }} |
| |
| # Don't reuse cache entries from any other Job. |
| gradle-home-cache-strict-match: true |
| |
| cache-encryption-key: ${{ inputs.gradle-encryption-key }} |
| |
| # Limit the size of the cache entry. |
| # These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly. |
| gradle-home-cache-excludes: | |
| caches/jars-9 |
| caches/transforms-3 |
| |
| - name: "gradle buildOnServer zipTestConfigsWithApks" |
| env: |
| JAVA_HOME: ${{ steps.setup-java.outputs.path }} |
| GRADLE_BUILD_CACHE_PASSWORD: ${{ inputs.gradle-cache-password }} |
| GRADLE_ENTERPRISE_ACCESS_KEY: ${{ inputs.gradle-enterprise-access-key }} |
| GRADLE_ENCRYPTION_KEY: ${{ inputs.gradle-encryption-key }} |
| working-directory: ${{ inputs.project-root }} |
| shell: bash |
| run: ./gradlew buildOnServer zipTestConfigsWithApks ${{ inputs.gradle-flags }} |
| - name: "gradle playgroundCIHostTests" |
| env: |
| JAVA_HOME: ${{ steps.setup-java.outputs.path }} |
| GRADLE_BUILD_CACHE_PASSWORD: ${{ inputs.gradle-cache-password }} |
| GRADLE_ENTERPRISE_ACCESS_KEY: ${{ inputs.gradle-enterprise-access-key }} |
| GRADLE_ENCRYPTION_KEY: ${{ inputs.gradle-encryption-key }} |
| working-directory: ${{ inputs.project-root }} |
| shell: bash |
| run: ./gradlew playgroundCIHostTests ${{ inputs.gradle-flags }} |