Avoid unnecessary map instance creations on Presences (#200) #666
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: Android CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
checks: | |
name: Checks | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
cache: 'gradle' | |
- run: chmod +x gradlew | |
- uses: gradle/actions/setup-gradle@v3 | |
- run: ./gradlew lintKotlin | |
- run: ./gradlew lint | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
cache: 'gradle' | |
- run: chmod +x gradlew | |
- uses: gradle/actions/setup-gradle@v3 | |
- run: ./gradlew yorkie:testDebugUnitTest | |
- run: ./gradlew yorkie:jacocoDebugTestReport | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: unit-test-artifact | |
path: yorkie/build/reports/jacoco/jacocoDebugTestReport/jacocoDebugTestReport.xml | |
instrumentation-tests: | |
name: Instrumentation tests | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: [ 24 ] | |
target: [ google_apis ] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
cache: 'gradle' | |
- run: chmod +x gradlew | |
- uses: gradle/actions/setup-gradle@v3 | |
- run: | | |
docker system prune --all --force | |
docker-compose -f docker/docker-compose-ci.yml up --build -d | |
- uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }}-${{ matrix.target }}-x86_64-4096m | |
- if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
ram-size: 4096M | |
emulator-boot-timeout: 12000 | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
ram-size: 4096M | |
emulator-boot-timeout: 12000 | |
disable-animations: true | |
script: | | |
adb shell pm list packages | grep dev.yorkie.test && adb uninstall dev.yorkie.test || true; | |
./gradlew yorkie:connectedCheck -Pandroid.testInstrumentationRunnerArguments.notAnnotation=dev.yorkie.TreeTest --no-build-cache --no-daemon --stacktrace | |
./gradlew yorkie:connectedCheck -Pandroid.testInstrumentationRunnerArguments.class=dev.yorkie.document.json.JsonTreeTest --no-build-cache --no-daemon --stacktrace | |
./gradlew yorkie:connectedCheck -Pandroid.testInstrumentationRunnerArguments.class=dev.yorkie.document.json.JsonTreeSplitMergeTest --no-build-cache --no-daemon --stacktrace | |
./gradlew yorkie:connectedCheck -Pandroid.testInstrumentationRunnerArguments.class=dev.yorkie.document.json.JsonTreeConcurrencyTest --no-build-cache --no-daemon --stacktrace | |
- if: ${{ matrix.api-level == 24 }} | |
run: ./gradlew yorkie:jacocoDebugTestReport | |
- if: ${{ matrix.api-level == 24 }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-test-artifact | |
path: yorkie/build/reports/jacoco/jacocoDebugTestReport/jacocoDebugTestReport.xml | |
codecov: | |
name: Codecov | |
needs: [ unit-tests, instrumentation-tests ] | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v2 | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: false | |
microbenchmarks: | |
name: Microbenchmarks | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
cache: 'gradle' | |
- run: chmod +x gradlew | |
- uses: gradle/actions/setup-gradle@v3 | |
- uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-30-google_apis-x86_64-4096m | |
- if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 32 | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
ram-size: 4096M | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 32 | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
ram-size: 4096M | |
disable-animations: true | |
script: | | |
./gradlew microbenchmark:assembleReleaseAndroidTest; | |
adb shell pm list packages | grep dev.yorkie.microbenchmark.test && adb uninstall dev.yorkie.microbenchmark.test || true; | |
adb install microbenchmark/build/outputs/apk/androidTest/release/microbenchmark-release-androidTest.apk; | |
adb shell am instrument -w -e no-isolated-storage true -e additionalTestOutputDir /sdcard/Download/ -e "androidx.benchmark.suppressErrors" "EMULATOR,LOW-BATTERY,UNLOCKED" dev.yorkie.microbenchmark.test/androidx.benchmark.junit4.AndroidBenchmarkRunner; | |
adb shell find /sdcard/Download -name "*-benchmarkData.json" | tr -d '\r' | xargs -n1 adb pull | |
- run: | | |
echo "$(cat dev.yorkie.microbenchmark.test-benchmarkData.json)" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: microbenchmark-artifact | |
path: dev.yorkie.microbenchmark.test-benchmarkData.json |