blob: 2f21ab4df13450692353b34c1fd65c8ba64771b2 [file] [log] [blame]
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, should be specified if gradle-cache-disabled is false"
required: false
default: ""
gradle-enterprise-access-key:
description: "access key for gradle enterprise"
gradle-encryption-key:
description: "key for gradle configuration cache encryption, should be specified if gradle-cache-disabled is false"
required: false
default: ""
gradle-flags:
description: "flags to pass while invoking gradle"
gradle-version:
description: "Version of gradle to use. Defaults to the version of gradlew if not specified."
required: false
default: wrapper
gradle-cache-disabled:
description: "Whether to disable the gradle build cache. Defaults to false (cache enabled)."
required: false
default: false
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/actions/setup-gradle@v4
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
gradle-version: ${{ inputs.gradle-version }}
cache-disabled: ${{ inputs.gradle-cache-disabled }}
- name: "gradle buildOnServer zipTestConfigsWithApks"
env:
JAVA_HOME: ${{ steps.setup-java.outputs.path }}
GRADLE_BUILD_CACHE_PASSWORD: ${{ inputs.gradle-cache-password }}
DEVELOCITY_ACCESS_KEY: ${{ inputs.gradle-enterprise-access-key }}
GRADLE_ENCRYPTION_KEY: ${{ inputs.gradle-encryption-key }}
working-directory: ${{ inputs.project-root }}
shell: bash
run: gradle buildOnServer zipTestConfigsWithApks ${{ inputs.gradle-flags }}
- name: "gradle playgroundCIHostTests"
env:
JAVA_HOME: ${{ steps.setup-java.outputs.path }}
GRADLE_BUILD_CACHE_PASSWORD: ${{ inputs.gradle-cache-password }}
DEVELOCITY_ACCESS_KEY: ${{ inputs.gradle-enterprise-access-key }}
GRADLE_ENCRYPTION_KEY: ${{ inputs.gradle-encryption-key }}
working-directory: ${{ inputs.project-root }}
shell: bash
run: gradle playgroundCIHostTests ${{ inputs.gradle-flags }}
# Zip artifacts because some paths contain ":", which upload-artifact does not accept.
- name: "Zip build artifacts"
continue-on-error: true
shell: bash
run: zip -r artifacts_${{ inputs.project }}.zip ~/dist
- name: "Upload build artifacts"
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: artifacts_${{ inputs.project }}
path: artifacts_${{ inputs.project }}.zip
- name: "Upload daemon logs"
continue-on-error: true
if: failure()
uses: actions/upload-artifact@v4
with:
name: gradle-daemon-logs_${{ inputs.project }}
path: ~/.gradle/daemon