Skip to content

Commit

Permalink
#9: combine ci & emulated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arburk committed Jan 7, 2024
1 parent 4b602f4 commit a1b672b
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on: [push]

jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-latest # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
env:
JAVA_TOOL_OPTIONS: -Xmx4g

steps:
- uses: actions/checkout@v4
- name: Current branch
run: echo Current branch=${GITHUB_REF#refs/heads/}

- name: checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -25,6 +30,7 @@ jobs:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v3
with:
Expand All @@ -36,13 +42,27 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew clean build jacocoTestReport
run: ./gradlew clean build

- name: run supportedSdksGroupDebugAndroidTest
id: check_pr
run: |
branch_name=$(echo ${GITHUB_REF#refs/heads/})
prs=$(curl -s -X GET -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${branch_name}")
if [ $branch_name != 'main' && $(echo "$prs" | jq length) -eq 0 ]; then
echo "Skip instrumented tests (no open PR found for branch $branch_name and not main branch)"
else
echo "Perform instrumented tests..."
./gradlew supportedSdksGroupDebugAndroidTest -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulators.emulator.showKernelLogging=true --info
fi
#if: github.event_name == 'pull_request' # perform emulated tests only on PRs
#run: ./gradlew supportedSdksGroupDebugAndroidTest -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulators.emulator.showKernelLogging=true --info

- name: Sonar checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar
run: ./gradlew jacocoTestReport sonar

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit a1b672b

Please sign in to comment.