ci: Add android checks and unit tests #30
Workflow file for this run
This file contains 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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Analyze, test, build, and ${{ github.event_name == 'pull_request' && 'validate on' || 'upload to' }} Google Play | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read asdf versions | |
id: asdf | |
run: cat .tool-versions | sed 's/ /=/' | tee -a "$GITHUB_OUTPUT" | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
aws-region: us-east-1 | |
- name: Configure GCP Credentials | |
uses: google-github-actions/auth@v1 | |
with: | |
create_credentials_file: true | |
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
# TODO: Get java version from .tool-versions? | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: gradle | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.konan | |
key: konan-${{ runner.os }}-${{ hashFiles('build.gradle.kts') }} | |
restore-keys: konan-${{ runner.os }} | |
# TODO: pre-commit run spotless | |
- run: ./gradlew spotlessCheck | |
- name: shared checks & unit tests | |
run: ./gradlew shared:check | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: android-shared-reports | |
path: shared/build/reports | |
- name: android checks & unit tests | |
run: ./gradlew androidApp:check | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: android-android-reports | |
path: androidApp/build/reports | |
- name: Fetch AWS secrets | |
uses: aws-actions/aws-secretsmanager-get-secrets@v1 | |
with: | |
secret-ids: | | |
mobile-app-android-upload-key-passphrase | |
- name: Load code signing key | |
run: | | |
cd androidApp | |
aws secretsmanager get-secret-value --secret-id mobile-app-android-upload-key --output json | jq -r '.SecretBinary' | base64 --decode > upload-keystore.jks | |
echo "storePassword=$MOBILE_APP_ANDROID_UPLOAD_KEY_PASSPHRASE" >> key.properties | |
echo "keyPassword=$MOBILE_APP_ANDROID_UPLOAD_KEY_PASSPHRASE" >> key.properties | |
echo "keyAlias=upload" >> key.properties | |
echo "storeFile=$(pwd)/upload-keystore.jks" >> key.properties |