Add bitmap cache for GoogleV2GeoItemLayer (rel. to #18404) #365
This file contains hidden or 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: Unit tests | |
| concurrency: | |
| group: ci-tests-${{ github.event.pull_request.head.label || github.ref }} | |
| cancel-in-progress: ${{ !((github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release') && github.event_name == 'push') }} | |
| on: | |
| push: | |
| pull_request_target: | |
| types: [opened, labeled, synchronize, reopened] | |
| workflow_dispatch: | |
| inputs: | |
| JDK_VERSION: | |
| description: The JDK version to use | |
| type: number | |
| default: 17 | |
| env: | |
| JDK_VERSION: ${{ inputs.JDK_VERSION || '17' }} | |
| permissions: | |
| actions: write | |
| contents: write | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| check-websites: | |
| if: > | |
| github.event_name != 'pull_request_target' || | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository && | |
| ( | |
| (github.event.action == 'labeled' && github.event.label.name == 'ok-to-test') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ok-to-test')) | |
| ) | |
| ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v6 | |
| with: | |
| # On push, use the push commit sha. On PR from cgeo/cgeo use the PR commit sha; on forks fall back to master | |
| ref: ${{ !github.event.pull_request && github.sha || github.event.pull_request && github.event.pull_request.head.repo.full_name == 'cgeo/cgeo' && github.event.pull_request.head.sha || 'master' }} | |
| - name: Check websites status | |
| uses: ./.github/actions/check-websites | |
| check-secrets: | |
| if: > | |
| github.event_name != 'pull_request_target' || | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository && | |
| ( | |
| github.event.action == 'opened' || github.event.action == 'reopened' || | |
| (github.event.action == 'labeled' && github.event.label.name == 'ok-to-test') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ok-to-test')) | |
| ) | |
| ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Debug concurrency-group | |
| run: | | |
| # concurrency: | |
| # group: ci-tests-${{ github.event.pull_request.head.label || github.ref }} | |
| # cancel-in-progress: ${{ !((github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release') && github.event_name == 'push') }} | |
| - name: Debug | |
| uses: raven-actions/debug@v1 | |
| - name: Check secrets | |
| run: | | |
| if [ -z "${{ secrets.KEY_STORE }}" ]; then | |
| echo "::error::No secret defined or no access to secrets" | |
| exit 1 | |
| fi | |
| echo "::notice::Secrets seems available" | |
| - name: Report Gradle cache key length | |
| run: | | |
| KEY="${{ secrets.GRADLE_ENCRYPTION_KEY }}" | |
| if [ -z "$KEY" ]; then | |
| echo "::warning::GRADLE_ENCRYPTION_KEY is empty" | |
| else | |
| KEY_LEN=${#KEY} | |
| echo "::notice::GRADLE_ENCRYPTION_KEY length: ${KEY_LEN}" | |
| if [ "$KEY_LEN" -ne 16 ] && [ "$KEY_LEN" -ne 24 ] && [ "$KEY_LEN" -ne 32 ]; then | |
| echo "::error::GRADLE_ENCRYPTION_KEY length must be 16, 24, or 32 bytes" | |
| exit 1 | |
| fi | |
| fi | |
| - name: Get User Permission | |
| id: checkAccess | |
| uses: actions-cool/check-user-permission@v2 | |
| with: | |
| require: write | |
| username: ${{ github.triggering_actor }} | |
| - name: Check User Permission | |
| if: > | |
| steps.checkAccess.outputs.require-result == 'false' && | |
| !contains(github.event.pull_request.labels.*.name, 'ok-to-test') && | |
| github.actor != 'dependabot[bot]' && | |
| github.actor != 'github-actions[bot]' && | |
| github.actor != 'github-merge-queue[bot]' | |
| run: | | |
| echo "::error::${{ github.triggering_actor }} does not have permissions on this repo.\nCurrent permission level is ${{ steps.checkAccess.outputs.user-permission }}\nJob originally triggered by ${{ github.actor }}" | |
| exit 1 | |
| # Using if to restrict to pull_request_target events, as the workflow will exit with error from previous step if the user does not have permissions, | |
| # so we can be sure that only users with permissions will reach this step and get the label added | |
| - name: Add ok-to-test label | |
| if: github.event_name == 'pull_request_target' | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh pr edit ${{ github.event.pull_request.number }} --add-label ok-to-test | |
| check-code-changed: | |
| if: > | |
| github.event_name != 'pull_request_target' || | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository && | |
| ( | |
| (github.event.action == 'labeled' && github.event.label.name == 'ok-to-test') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ok-to-test')) | |
| ) | |
| ) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| code-changed: ${{ steps.detect.outputs.has-code-changes }} | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Detect code changes | |
| id: changes | |
| uses: tj-actions/changed-files@v47 | |
| with: | |
| files: | | |
| main/** | |
| gradle/** | |
| build.gradle | |
| settings.gradle | |
| mapswithme-api/** | |
| organicmaps-api/** | |
| files_ignore: | | |
| .github/** | |
| - name: Set code-changed output | |
| id: detect | |
| run: echo "has-code-changes=${{ steps.changes.outputs.any_changed }}" >> $GITHUB_OUTPUT | |
| checkstyle: | |
| if: > | |
| github.event_name != 'pull_request_target' || | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository && | |
| ( | |
| (github.event.action == 'labeled' && github.event.label.name == 'ok-to-test') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ok-to-test')) | |
| ) | |
| ) | |
| runs-on: ubuntu-latest | |
| needs: check-secrets | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup cgeo preferences and keystore | |
| uses: ./.github/actions/cgeo-preferences | |
| with: | |
| KEY_STORE: ${{ secrets.KEY_STORE }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
| KEY_ALIAS_PASSWORD: ${{ secrets.KEY_ALIAS_PASSWORD }} | |
| MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }} | |
| MAPS_API_KEY_MARKET: ${{ secrets.MAPS_API_KEY_MARKET }} | |
| MAPS_API2_KEY: ${{ secrets.MAPS_API2_KEY }} | |
| OCDE_OKAPI_CONSUMER_KEY: ${{ secrets.OCDE_OKAPI_CONSUMER_KEY }} | |
| OCDE_OKAPI_CONSUMER_SECRET: ${{ secrets.OCDE_OKAPI_CONSUMER_SECRET }} | |
| OCPL_OKAPI_CONSUMER_KEY: ${{ secrets.OCPL_OKAPI_CONSUMER_KEY }} | |
| OCPL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCPL_OKAPI_CONSUMER_SECRET }} | |
| OCUS_OKAPI_CONSUMER_KEY: ${{ secrets.OCUS_OKAPI_CONSUMER_KEY }} | |
| OCUS_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUS_OKAPI_CONSUMER_SECRET }} | |
| OCNL_OKAPI_CONSUMER_KEY: ${{ secrets.OCNL_OKAPI_CONSUMER_KEY }} | |
| OCNL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCNL_OKAPI_CONSUMER_SECRET }} | |
| OCRO_OKAPI_CONSUMER_KEY: ${{ secrets.OCRO_OKAPI_CONSUMER_KEY }} | |
| OCRO_OKAPI_CONSUMER_SECRET: ${{ secrets.OCRO_OKAPI_CONSUMER_SECRET }} | |
| OCUK_OKAPI_CONSUMER_KEY: ${{ secrets.OCUK_OKAPI_CONSUMER_KEY }} | |
| OCUK_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUK_OKAPI_CONSUMER_SECRET }} | |
| SU_CONSUMER_KEY: ${{ secrets.SU_CONSUMER_KEY }} | |
| SU_CONSUMER_SECRET: ${{ secrets.SU_CONSUMER_SECRET }} | |
| THUNDERFOREST_API_KEY: ${{ secrets.THUNDERFOREST_API_KEY }} | |
| ALC_CONSUMER_KEY: ${{ secrets.ALC_CONSUMER_KEY }} | |
| PREF_COOKIESTORE: ${{ secrets.PREF_COOKIESTORE }} | |
| PREF_USERNAME: ${{ secrets.PREF_USERNAME }} | |
| PREF_PASSWORD: ${{ secrets.PREF_PASSWORD }} | |
| - name: Set up JDK ${{ env.JDK_VERSION }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ env.JDK_VERSION }} | |
| distribution: temurin | |
| - name: Report Gradle cache key length | |
| run: | | |
| KEY="${{ secrets.GRADLE_ENCRYPTION_KEY }}" | |
| if [ -z "$KEY" ]; then | |
| echo "::warning::GRADLE_ENCRYPTION_KEY is empty" | |
| else | |
| KEY_LEN=${#KEY} | |
| echo "::notice::GRADLE_ENCRYPTION_KEY length: ${KEY_LEN}" | |
| if [ "$KEY_LEN" -ne 16 ] && [ "$KEY_LEN" -ne 24 ] && [ "$KEY_LEN" -ne 32 ]; then | |
| echo "::error::GRADLE_ENCRYPTION_KEY length must be 16, 24, or 32 bytes" | |
| exit 1 | |
| fi | |
| fi | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/release' }} | |
| cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| add-job-summary-as-pr-comment: never # Valid values are 'never' (default), 'always', and 'on-failure' | |
| - name: Run checkstyle | |
| run: ./gradlew --no-daemon --scan checkstyle | |
| - uses: lcollins/checkstyle-github-action@v3.2.0 | |
| with: | |
| path: 'main/build/reports/checkstyle/checkstyle.xml' | |
| lint: | |
| if: > | |
| github.event_name != 'pull_request_target' || | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository && | |
| ( | |
| (github.event.action == 'labeled' && github.event.label.name == 'ok-to-test') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ok-to-test')) | |
| ) | |
| ) | |
| runs-on: ubuntu-latest | |
| needs: check-secrets | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup cgeo preferences and keystore | |
| uses: ./.github/actions/cgeo-preferences | |
| with: | |
| KEY_STORE: ${{ secrets.KEY_STORE }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
| KEY_ALIAS_PASSWORD: ${{ secrets.KEY_ALIAS_PASSWORD }} | |
| MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }} | |
| MAPS_API_KEY_MARKET: ${{ secrets.MAPS_API_KEY_MARKET }} | |
| MAPS_API2_KEY: ${{ secrets.MAPS_API2_KEY }} | |
| OCDE_OKAPI_CONSUMER_KEY: ${{ secrets.OCDE_OKAPI_CONSUMER_KEY }} | |
| OCDE_OKAPI_CONSUMER_SECRET: ${{ secrets.OCDE_OKAPI_CONSUMER_SECRET }} | |
| OCPL_OKAPI_CONSUMER_KEY: ${{ secrets.OCPL_OKAPI_CONSUMER_KEY }} | |
| OCPL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCPL_OKAPI_CONSUMER_SECRET }} | |
| OCUS_OKAPI_CONSUMER_KEY: ${{ secrets.OCUS_OKAPI_CONSUMER_KEY }} | |
| OCUS_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUS_OKAPI_CONSUMER_SECRET }} | |
| OCNL_OKAPI_CONSUMER_KEY: ${{ secrets.OCNL_OKAPI_CONSUMER_KEY }} | |
| OCNL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCNL_OKAPI_CONSUMER_SECRET }} | |
| OCRO_OKAPI_CONSUMER_KEY: ${{ secrets.OCRO_OKAPI_CONSUMER_KEY }} | |
| OCRO_OKAPI_CONSUMER_SECRET: ${{ secrets.OCRO_OKAPI_CONSUMER_SECRET }} | |
| OCUK_OKAPI_CONSUMER_KEY: ${{ secrets.OCUK_OKAPI_CONSUMER_KEY }} | |
| OCUK_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUK_OKAPI_CONSUMER_SECRET }} | |
| SU_CONSUMER_KEY: ${{ secrets.SU_CONSUMER_KEY }} | |
| SU_CONSUMER_SECRET: ${{ secrets.SU_CONSUMER_SECRET }} | |
| THUNDERFOREST_API_KEY: ${{ secrets.THUNDERFOREST_API_KEY }} | |
| ALC_CONSUMER_KEY: ${{ secrets.ALC_CONSUMER_KEY }} | |
| PREF_COOKIESTORE: ${{ secrets.PREF_COOKIESTORE }} | |
| PREF_USERNAME: ${{ secrets.PREF_USERNAME }} | |
| PREF_PASSWORD: ${{ secrets.PREF_PASSWORD }} | |
| - name: Set up JDK ${{ env.JDK_VERSION }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ env.JDK_VERSION }} | |
| distribution: temurin | |
| - name: Report Gradle cache key length | |
| run: | | |
| KEY="${{ secrets.GRADLE_ENCRYPTION_KEY }}" | |
| if [ -z "$KEY" ]; then | |
| echo "::warning::GRADLE_ENCRYPTION_KEY is empty" | |
| else | |
| KEY_LEN=${#KEY} | |
| echo "::notice::GRADLE_ENCRYPTION_KEY length: ${KEY_LEN}" | |
| if [ "$KEY_LEN" -ne 16 ] && [ "$KEY_LEN" -ne 24 ] && [ "$KEY_LEN" -ne 32 ]; then | |
| echo "::error::GRADLE_ENCRYPTION_KEY length must be 16, 24, or 32 bytes" | |
| exit 1 | |
| fi | |
| fi | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/release' }} | |
| cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| add-job-summary-as-pr-comment: never # Valid values are 'never' (default), 'always', and 'on-failure' | |
| - name: Run lintBasicDebug | |
| run: ./gradlew --no-daemon --scan lintBasicDebug | |
| - name: Check and report lint results | |
| uses: hidakatsuya/action-report-android-lint@v1 | |
| with: | |
| result-path: 'main/build/reports/lint-results-basicDebug.xml' | |
| fail-on-warning: false | |
| integration-tests: | |
| if: > | |
| needs.check-code-changed.outputs.code-changed == 'true' && | |
| ( | |
| github.event_name != 'pull_request_target' || | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository && | |
| ( | |
| (github.event.action == 'labeled' && github.event.label.name == 'ok-to-test') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ok-to-test')) | |
| ) | |
| ) | |
| ) | |
| # > It is now recommended to use the Ubuntu (ubuntu-latest) runners which | |
| # > are 2-3 times faster than the macOS ones which are also a lot more expensive. | |
| # https://github.com/ReactiveCircus/android-emulator-runner#running-hardware-accelerated-emulators-on-linux-runners | |
| runs-on: ubuntu-latest | |
| needs: [check-secrets, check-websites, check-code-changed] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| api-level: [26, 30, 34] | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ | |
| - name: Enable KVM group perms | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Setup cgeo preferences and keystore | |
| uses: ./.github/actions/cgeo-preferences | |
| with: | |
| KEY_STORE: ${{ secrets.KEY_STORE }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
| KEY_ALIAS_PASSWORD: ${{ secrets.KEY_ALIAS_PASSWORD }} | |
| MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }} | |
| MAPS_API_KEY_MARKET: ${{ secrets.MAPS_API_KEY_MARKET }} | |
| MAPS_API2_KEY: ${{ secrets.MAPS_API2_KEY }} | |
| OCDE_OKAPI_CONSUMER_KEY: ${{ secrets.OCDE_OKAPI_CONSUMER_KEY }} | |
| OCDE_OKAPI_CONSUMER_SECRET: ${{ secrets.OCDE_OKAPI_CONSUMER_SECRET }} | |
| OCPL_OKAPI_CONSUMER_KEY: ${{ secrets.OCPL_OKAPI_CONSUMER_KEY }} | |
| OCPL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCPL_OKAPI_CONSUMER_SECRET }} | |
| OCUS_OKAPI_CONSUMER_KEY: ${{ secrets.OCUS_OKAPI_CONSUMER_KEY }} | |
| OCUS_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUS_OKAPI_CONSUMER_SECRET }} | |
| OCNL_OKAPI_CONSUMER_KEY: ${{ secrets.OCNL_OKAPI_CONSUMER_KEY }} | |
| OCNL_OKAPI_CONSUMER_SECRET: ${{ secrets.OCNL_OKAPI_CONSUMER_SECRET }} | |
| OCRO_OKAPI_CONSUMER_KEY: ${{ secrets.OCRO_OKAPI_CONSUMER_KEY }} | |
| OCRO_OKAPI_CONSUMER_SECRET: ${{ secrets.OCRO_OKAPI_CONSUMER_SECRET }} | |
| OCUK_OKAPI_CONSUMER_KEY: ${{ secrets.OCUK_OKAPI_CONSUMER_KEY }} | |
| OCUK_OKAPI_CONSUMER_SECRET: ${{ secrets.OCUK_OKAPI_CONSUMER_SECRET }} | |
| SU_CONSUMER_KEY: ${{ secrets.SU_CONSUMER_KEY }} | |
| SU_CONSUMER_SECRET: ${{ secrets.SU_CONSUMER_SECRET }} | |
| THUNDERFOREST_API_KEY: ${{ secrets.THUNDERFOREST_API_KEY }} | |
| ALC_CONSUMER_KEY: ${{ secrets.ALC_CONSUMER_KEY }} | |
| PREF_COOKIESTORE: ${{ secrets.PREF_COOKIESTORE }} | |
| PREF_USERNAME: ${{ secrets.PREF_USERNAME }} | |
| PREF_PASSWORD: ${{ secrets.PREF_PASSWORD }} | |
| - name: Set up JDK ${{ env.JDK_VERSION }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ env.JDK_VERSION }} | |
| distribution: temurin | |
| - name: Report Gradle cache key length | |
| run: | | |
| KEY="${{ secrets.GRADLE_ENCRYPTION_KEY }}" | |
| if [ -z "$KEY" ]; then | |
| echo "::warning::GRADLE_ENCRYPTION_KEY is empty" | |
| else | |
| KEY_LEN=${#KEY} | |
| echo "::notice::GRADLE_ENCRYPTION_KEY length: ${KEY_LEN}" | |
| if [ "$KEY_LEN" -ne 16 ] && [ "$KEY_LEN" -ne 24 ] && [ "$KEY_LEN" -ne 32 ]; then | |
| echo "::error::GRADLE_ENCRYPTION_KEY length must be 16, 24, or 32 bytes" | |
| exit 1 | |
| fi | |
| fi | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/release' }} | |
| cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| add-job-summary-as-pr-comment: never # Valid values are 'never' (default), 'always', and 'on-failure' | |
| - name: Build binary | |
| run: | | |
| ./gradlew --scan packageBasicDebug | |
| ./gradlew packageBasicDebugAndroidTest | |
| - name: Upload resulting APK | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: "cgeo-apk-api${{ matrix.api-level }}" | |
| path: '*/build/outputs/apk/basic/**/cgeo*.apk' | |
| overwrite: true | |
| - name: AVD cache | |
| uses: actions/cache@v6 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-${{ matrix.api-level }} | |
| - name: create AVD and generate snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| target: google_apis | |
| arch: x86_64 | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: false | |
| script: echo "Generated AVD snapshot for caching." | |
| # Allow only one job at a time (prevent errors on live GC tests) | |
| - name: Wait for lock on live tests | |
| id: lock-tests | |
| run: | | |
| function unlock() { | |
| curl -X POST -qSs "https://mutex.kumy.org/api/client/${{ secrets.MUTEX_SECRET }}/mutex/unit-test?unlock" | |
| } | |
| # Unlock immediatelly if we just get the lock and the step is cancelled | |
| trap unlock SIGINT | |
| TIMEOUT_MINUTES=120 | |
| i=0 | |
| locked=false | |
| while [ "$i" -lt $(( 6 * $TIMEOUT_MINUTES )) ] && ! curl -X POST -qSs "https://mutex.kumy.org/api/client/${{ secrets.MUTEX_SECRET }}/mutex/unit-test?lock&waitTimeoutMs=10000" --fail | |
| do ((i+=1)) | |
| done && locked=true | |
| - name: Run Unit Tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| env: | |
| # Define BUILD_NUMBER environment variable else the change from commit | |
| # https://github.com/cgeo/cgeo/commit/cfa797e3a48cbd581a31f470703ee15ddb191f49 | |
| # prevent us to be recognized as a runner, which lead to appID being suffixed | |
| # by ".developer" thus leading to failure installing the cgeo prefrences | |
| BUILD_NUMBER: ${{ github.run_number }} | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| 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 | |
| disable-animations: true | |
| script: | | |
| # Capture logcat output ; see https://github.com/ReactiveCircus/android-emulator-runner/issues/228 | |
| adb logcat -c || true | |
| adb logcat > /tmp/cgeo-apk-api${{ matrix.api-level }}.logcat.txt & | |
| ./gradlew --scan testDebug -Pandroid.testInstrumentationRunnerArguments.notAnnotation=cgeo.geocaching.test.NotForIntegrationTests || { killall -INT crashpad_handler; false; } | |
| killall -INT crashpad_handler || true | |
| - name: Unlock live tests | |
| # unlock only if we locked it | |
| if: always() && steps.lock-tests.conclusion == 'success' | |
| run: | | |
| curl -X POST -qSs "https://mutex.kumy.org/api/client/${{ secrets.MUTEX_SECRET }}/mutex/unit-test?unlock" | |
| - name: Upload logcat | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: "cgeo-apk-api${{ matrix.api-level }}.logcat" | |
| path: '/tmp/cgeo-apk-api*.logcat.txt' | |
| overwrite: true | |
| # - name: Add PR comment with logcat output | |
| # if: failure() && (github.event_name == 'pull_request_target' || github.event_name == 'pull_request') | |
| # uses: thollander/actions-comment-pull-request@v3 | |
| # with: | |
| # file-path: /tmp/cgeo-apk-api${{ matrix.api-level }}.logcat.txt | |
| # comment-tag: cgeo-apk-api${{ matrix.api-level }}.logcat | |
| # reactions: eyes, rocket | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: always() # always run even if the previous step fails | |
| with: | |
| report_paths: '**/build/test-results/**/*.xml' | |
| rerun-on-failure: | |
| needs: integration-tests | |
| if: > | |
| failure() && fromJSON(github.run_attempt) < 3 && | |
| ( | |
| github.event_name != 'pull_request_target' || | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository && | |
| ( | |
| (github.event.action == 'labeled' && github.event.label.name == 'ok-to-test') || | |
| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ok-to-test')) | |
| ) | |
| ) | |
| ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} | |
| GH_DEBUG: api | |
| run: gh workflow run unit-tests-rerun.yml -F run_id=${{ github.run_id }} |