Repository navigation
fix: release GoogleMap listeners and dispose subcomposition when showing/hiding map #2456
Workflow file for this run
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
| # Copyright 2020 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # A workflow that runs tests on every new pull request | |
| name: Run instrumentation tests | |
| on: | |
| repository_dispatch: | |
| types: [test] | |
| pull_request: | |
| branches-ignore: ['gh-pages'] | |
| workflow_dispatch: | |
| jobs: | |
| run-instrumentation-test: | |
| runs-on: macOS-latest-large # enables hardware acceleration in the virtual machine | |
| permissions: | |
| pull-requests: write | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| - name: Inject Maps API Key | |
| env: | |
| MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }} | |
| run: | | |
| [ -z "$MAPS_API_KEY" ] && MAPS_API_KEY="YOUR_API_KEY"; echo "MAPS_API_KEY=$MAPS_API_KEY" >> ./secrets.properties | |
| - name: Build debug | |
| run: ./gradlew assembleDebug | |
| - name: Run instrumentation tests | |
| uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0 | |
| with: | |
| api-level: 29 | |
| target: google_apis | |
| arch: x86 | |
| disable-animations: true | |
| # The demo smoke tests run in their own workflow, see demo-smoke-test.yml. | |
| script: ./gradlew createDebugCoverageReport :maps-app:createLibraryCoverageReports --stacktrace -Pandroid.testInstrumentationRunnerArguments.notPackage=com.google.maps.android.compose.smoke | |
| # Stage the coverage reports flat, named after their module, and publish | |
| # them so the post-merge "Record coverage history" workflow can read them | |
| # without paying for a second emulator run. Staging matters because | |
| # actions/upload-artifact strips the common parent directory, which would | |
| # discard the module name whenever only one report exists. | |
| - name: Stage coverage reports | |
| if: always() | |
| run: | | |
| mkdir -p instrumentation-coverage | |
| for report in */build/reports/coverage/androidTest/debug/connected/report.xml; do | |
| [ -e "$report" ] || continue | |
| cp "$report" "instrumentation-coverage/${report%%/*}.xml" | |
| done | |
| # Library modules, reported from the coverage data of every emulator test run. This | |
| # replaces maps-compose-widgets' own report, which only counted its own tests. | |
| for report in maps-app/build/reports/library-coverage/*.xml; do | |
| [ -e "$report" ] || continue | |
| cp "$report" instrumentation-coverage/ | |
| done | |
| ls -l instrumentation-coverage | |
| - name: Upload coverage reports | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: instrumentation-coverage | |
| path: instrumentation-coverage | |
| if-no-files-found: warn | |
| - name: Jacoco Report to PR | |
| id: jacoco | |
| # Pull requests from forks do not get repository secrets, so the token is empty and | |
| # the step fails. Skip it there; the tests themselves still run. | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| uses: madrapps/jacoco-report@e51ce1f46f7f8b5331593f935e59cbaf44b84920 # v1.8.0 | |
| with: | |
| paths: | | |
| ${{ github.workspace }}/maps-app/build/reports/coverage/androidTest/debug/connected/report.xml, | |
| ${{ github.workspace }}/maps-app/build/reports/library-coverage/maps-compose.xml, | |
| ${{ github.workspace }}/maps-app/build/reports/library-coverage/maps-compose-utils.xml, | |
| ${{ github.workspace }}/maps-app/build/reports/library-coverage/maps-compose-widgets.xml | |
| token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} | |
| min-coverage-overall: 26 | |
| min-coverage-changed-files: 60 | |
| title: Coverage (instrumentation tests) | |
| debug-mode: false | |
| update-comment: true | |
| - name: Get the Coverage info | |
| env: | |
| COVERAGE_OVERALL: ${{ steps.jacoco.outputs.coverage-overall }} | |
| COVERAGE_CHANGED_FILES: ${{ steps.jacoco.outputs.coverage-changed-files }} | |
| run: | | |
| echo "Total coverage $COVERAGE_OVERALL" | |
| echo "Changed Files coverage $COVERAGE_CHANGED_FILES" | |
| - name: Upload test reports | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: test-reports | |
| path: ./maps-app/build/reports |