Skip to content

Check Access Key Presence to avoid Build Cache errors on PR builds where Key is not present #1088

Check Access Key Presence to avoid Build Cache errors on PR builds where Key is not present

Check Access Key Presence to avoid Build Cache errors on PR builds where Key is not present #1088

name: Verify Build
on:
push:
branches: [ main, citest ]
pull_request:
workflow_dispatch:
jobs:
generate_versions:
name: Generate versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: setup-matrix
run: echo "matrix=$(jq -cM '.supportedVersions | keys' src/main/resources/versions.json | sed -e 's/\./_/g' -e 's/-/_/g')" >> $GITHUB_OUTPUT
- name: debug
run: echo "matrix=${{ steps.setup-matrix.outputs.matrix }}"
outputs:
matrix: ${{ steps.setup-matrix.outputs.matrix }}
sanity_check:
name: Sanity check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Run sanityCheck
run: ./gradlew sanityCheck -Porg.gradle.java.installations.auto-download=false
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Run unit tests
run: >-
./gradlew test
-x signPluginMavenPublication
-x signAndroidCacheFixPluginPluginMarkerMavenPublication
-Porg.gradle.java.installations.auto-download=false
-Dpts.mode=$PTS_MODE
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
PTS_MODE: "${{ github.ref_name == 'main' && 'REMAINING_TESTS' || 'RELEVANT_TESTS' }}"
android_version_tests:
name: Android version tests
needs: [ generate_versions, sanity_check ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
versions: ${{ fromJson(needs.generate_versions.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
# Patch issue in platform-tools 31.0.3 where platform-tools/api/api-versions.xml is missing (see https://issuetracker.google.com/issues/195445762)
- name: Patch api-versions
run: sudo test -f $ANDROID_HOME/platform-tools/api/api-versions.xml || (sudo mkdir $ANDROID_HOME/platform-tools/api && sudo cp .github/api-versions.xml $ANDROID_HOME/platform-tools/api/api-versions.xml)
- name: List Android Packages
run: sudo $ANDROID_HOME/tools/bin/sdkmanager --list | sed -n '/Available Packages/q;p'
- name: Accept license 34.0.0
run: echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "build-tools;34.0.0"
- name: Setup ZULU_JDK
uses: actions/setup-java@v3
with:
java-version: 11.0.12
distribution: 'zulu'
- name: Set ZULU_JDK environment variable
run: |
echo "ZULU_JDK=$JAVA_HOME" >> $GITHUB_ENV
- name: Setup ZULU_ALT_JDK
uses: actions/setup-java@v3
with:
java-version: 11.0.13
distribution: 'zulu'
- name: Set ZULU_ALT_JDK environment variable
run: |
echo "ZULU_ALT_JDK=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up Java 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Run integration tests
run: >-
./gradlew testAndroid${{ matrix.versions }}
-x signPluginMavenPublication
-x signAndroidCacheFixPluginPluginMarkerMavenPublication
-Porg.gradle.java.installations.auto-download=false
-Dpts.mode=$PTS_MODE
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
PTS_MODE: "${{ github.ref_name == 'main' && 'REMAINING_TESTS' || 'RELEVANT_TESTS' }}"