Skip to content

Gmsaas apitoken migration (#1029) #1298

Gmsaas apitoken migration (#1029)

Gmsaas apitoken migration (#1029) #1298

Workflow file for this run

name: Android CI
on:
push:
branches: [ main ]
paths: [ '.github/**', 'android/**' ]
pull_request:
branches: [ main ]
paths: [ '.github/**', 'android/**' ]
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
# Setup
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Deploy APK signing keystore and related secrets (test signing)
if: ${{ github.event_name != 'pull_request' }}
env:
KEYSTORE_BASE64: ${{ secrets.APK_SIGNING_TEST_KEYSTORE }}
KEYSTORE_PATH: ${{ runner.temp }}/apk_signing_keystore.jks
run: echo $KEYSTORE_BASE64 | base64 --decode > $KEYSTORE_PATH
# Build
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle and run tests
env:
ORG_GRADLE_PROJECT_apkSigningKeystorePath: ${{ runner.temp }}/apk_signing_keystore.jks
ORG_GRADLE_PROJECT_apkSigningKeyAlias: signing
ORG_GRADLE_PROJECT_apkSigningKeystorePassword: ${{ secrets.APK_SIGNING_TEST_PASSWORD }}
ORG_GRADLE_PROJECT_apkSigningKeyPassword: ${{ secrets.APK_SIGNING_TEST_PASSWORD }}
run: ./gradlew build
# Upload binaries to workflow artifacts
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: binaries
path: |
android/clientlib/build/outputs/aar/*.aar
android/clientlib-ktx/build/outputs/aar/*.aar
android/common/build/outputs/aar/*.aar
android/fakedapp/build/outputs/apk/**/*.apk
android/fakewallet/build/outputs/apk/**/*.apk
android/walletlib/build/outputs/aar/*.aar
if-no-files-found: error
retention-days: 5
# Upload javadoc to workflow artifacts
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: clientlib-javadoc
path: |
android/clientlib/build/docs/*
!android/clientlib/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: common-javadoc
path: |
android/common/build/docs/*
!android/common/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: walletlib-javadoc
path: |
android/walletlib/build/docs/*
!android/walletlib/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1
# Publish to Maven Central (only for releases that start with 'v')
- name: Publish to Maven Central (release only)
if: ${{ github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v') }}
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PASSWORD }}
TAG: ${{ github.event.release.tag_name }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -P version=${TAG:1}
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
include:
- api-level: 27
recipe_uuid: ea5fda48-fa8b-48c1-8acc-07d910856141 # Pixel XL, Android 8.1 (API 27)
# fb936099-d261-4dd3-8dec-3fc14f1d0f03 # Pixel 3a, Android 9.0 (API 28)
# 4c015ada-e64e-4f5d-a320-06cbf6e95648 # Pixel 3a, Android 10 (API 29)
# 95016679-8f8d-4890-b026-e4ad889aadf1 # Pixel 3a, Android 11 (API 30)
# see here for more recipes: https://support.genymotion.com/hc/en-us/articles/360007473658-Supported-Android-devices-templates-for-Genymotion-Cloud-SaaS
steps:
# Setup
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9.16"
architecture: "x64"
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v3
# Caching
- name: Gradle cache
uses: gradle/actions/setup-gradle@v4
# Create Genymotion instance
- name: Start Genymotion Cloud SaaS instance
uses: genymobile/genymotion-saas-github-action@v1
with:
api_token: ${{ secrets.GMSAAS_API_KEY }}
recipe_uuid: ${{ matrix.recipe_uuid }}
# Run the tests
- name: Run Android Integration Tests
run: |
cd android
adb shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS
./gradlew :fakewallet:connectedV1DebugAndroidTest
./gradlew :fakewallet:installV1Debug :fakedapp:connectedDebugAndroidTest
# Archive test results
- name: Archive fakewallet test results
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: fakewallet-connected-test-results-${{ matrix.api-level }}
path: android/fakewallet/build/reports/androidTests/connected/
retention-days: 7
- name: Archive fakedapp test results
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: fakedapp-connected-test-results-${{ matrix.api-level }}
path: android/fakedapp/build/reports/androidTests/connected/
retention-days: 7
# Note: only runs on 'push' events
publish-to-gh-pages:
runs-on: ubuntu-latest
needs: build
concurrency: publish-to-gh-pages
if: ${{ github.event_name == 'push' }}
steps:
- name: Update clientlib javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v2
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
artifact-name: clientlib-javadoc
dest: clientlib
commit-message: 'Update clientlib javadoc'
- name: Update common javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v2
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
artifact-name: common-javadoc
dest: common
commit-message: 'Update common javadoc'
- name: Update walletlib javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v2
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
artifact-name: walletlib-javadoc
dest: walletlib
commit-message: 'Update walletlib javadoc'
# Note: only runs on 'release' events
upload-to-release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write # needed for uploading files to releases
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/download-artifact@v4
with:
name: binaries
path: binaries
- uses: actions/download-artifact@v4
with:
name: clientlib-javadoc
path: clientlib-javadoc
- uses: actions/download-artifact@v4
with:
name: common-javadoc
path: common-javadoc
- uses: actions/download-artifact@v4
with:
name: walletlib-javadoc
path: walletlib-javadoc
- name: Compress clientlib javadoc
run: tar -cvzf clientlib-javadoc/clientlib-javadoc.tgz -C clientlib-javadoc javadoc
- name: Compress common javadoc
run: tar -cvzf common-javadoc/common-javadoc.tgz -C common-javadoc javadoc
- name: Compress walletlib javadoc
run: tar -cvzf walletlib-javadoc/walletlib-javadoc.tgz -C walletlib-javadoc javadoc
- name: Upload files to release
run: find ${FILES} -type f -exec gh release -R ${GITHUB_REPOSITORY} upload ${TAG} {} +
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name }}
FILES: |
binaries/
clientlib-javadoc/clientlib-javadoc.tgz
common-javadoc/common-javadoc.tgz
walletlib-javadoc/walletlib-javadoc.tgz