add emulator of google_apis to ci #4
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: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- dev | |
- main | |
- release** | |
paths-ignore: | |
- 'README.md' | |
push: | |
branches: | |
- dev | |
- main | |
paths-ignore: | |
- 'README.md' | |
jobs: | |
build-and-test-jvm: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: create and checkout branch | |
# push events already checked out the branch | |
if: github.event_name == 'pull_request' | |
env: | |
BRANCH: ${{ github.head_ref }} | |
run: git checkout -B "$BRANCH" | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: "temurin" | |
cache: 'gradle' | |
- name: Build debug APK and run jvm tests | |
run: ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace -DskipFormatKtlint | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app | |
path: app/build/outputs/apk/debug/*.apk | |
test-android: | |
# macos has hardware acceleration. See android-emulator-runner action | |
runs-on: macos-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
include: | |
- api-level: 30 | |
target: google_apis | |
arch: x86 | |
- api-level: 34 | |
target: google_apis | |
arch: x86_64 | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: "temurin" | |
cache: 'gradle' | |
- name: Run android tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
script: ./gradlew connectedCheck --stacktrace | |
- name: Upload test report when tests fail | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: android-test-report-api${{ matrix.api-level }} | |
path: app/build/reports/androidTests/connected/** | |
# sonar: | |
# runs-on: ubuntu-latest | |
# | |
# permissions: | |
# contents: read | |
# | |
# steps: | |
# - uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
# | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v4 | |
# with: | |
# java-version: 17 | |
# distribution: "temurin" | |
# cache: 'gradle' | |
# | |
# - name: Cache SonarCloud packages | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/.sonar/cache | |
# key: ${{ runner.os }}-sonar | |
# restore-keys: ${{ runner.os }}-sonar | |
# | |
# - name: Build and analyze | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# run: ./gradlew build sonar --info |