Update Mapsforge/VTM to v0.27 #354
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: [labeled, opened, synchronize] | |
| workflow_dispatch: | |
| inputs: | |
| JDK_VERSION: | |
| description: The JDK version to use | |
| type: number | |
| default: 17 | |
| env: | |
| JDK_VERSION: ${{ inputs.JDK_VERSION || '17' }} | |
| permissions: | |
| contents: write | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| check-secrets: | |
| 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: 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, 'safe to test') && github.actor != 'dependabot[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 | |
| checkstyle: | |
| runs-on: ubuntu-latest | |
| needs: check-secrets | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v4 | |
| 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@v4 | |
| with: | |
| java-version: ${{ env.JDK_VERSION }} | |
| distribution: temurin | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| 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: on-failure # Valid values are 'never' (default), 'always', and 'on-failure' | |
| - name: Run checkstyle | |
| run: ./gradlew --no-daemon --scan checkstyle | |
| - uses: lcollins/checkstyle-github-action@v3.1.0 | |
| with: | |
| path: 'main/build/reports/checkstyle/checkstyle.xml' | |
| lint: | |
| runs-on: ubuntu-latest | |
| needs: check-secrets | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v4 | |
| 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@v4 | |
| with: | |
| java-version: ${{ env.JDK_VERSION }} | |
| distribution: temurin | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| 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: on-failure # 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: | |
| # > 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 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| api-level: [26, 30, 34] | |
| steps: | |
| - name: Checkout the latest code | |
| uses: actions/checkout@v4 | |
| 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@v4 | |
| with: | |
| java-version: ${{ env.JDK_VERSION }} | |
| distribution: temurin | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| 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: on-failure # 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@v4 | |
| with: | |
| name: "cgeo-apk-api${{ matrix.api-level }}" | |
| path: '*/build/outputs/apk/basic/**/cgeo*.apk' | |
| overwrite: true | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| 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 | |
| uses: suzuki-shunsuke/lock-action@latest | |
| with: | |
| mode: lock | |
| key: unit-test | |
| # Try to acquire a lock every 30 seconds until acquiring a lock or 2 hours pass. | |
| max_wait_seconds: "7200" | |
| wait_interval_seconds: "30" | |
| post_unlock: "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: | | |
| ./gradlew --scan testDebug -Pandroid.testInstrumentationRunnerArguments.notAnnotation=cgeo.geocaching.test.NotForIntegrationTests || { killall -INT crashpad_handler; false; } | |
| killall -INT crashpad_handler || true | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v4 | |
| if: always() # always run even if the previous step fails | |
| with: | |
| report_paths: '**/build/test-results/**/*.xml' |