Repository navigation
chore(main): release 9.0.1 #2515
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 2024 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 unit tests | |
| on: | |
| repository_dispatch: | |
| types: [test] | |
| pull_request: | |
| branches-ignore: ['gh-pages'] | |
| workflow_dispatch: | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - 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: Build modules | |
| run: ./gradlew build koverXmlReportDebug -x :maps-app:generateDebugScreenshotTestConfig -x :maps-app:generateReleaseScreenshotTestConfig --stacktrace | |
| - name: Run Screenshot Tests | |
| run: ./gradlew :maps-app:validateDebugScreenshotTest | |
| # Post (or update) a single sticky comment showing how this PR moves unit | |
| # coverage relative to the last entry recorded for main. Instrumentation | |
| # coverage gets its own comment from instrumentation-test.yml. Pull requests | |
| # from forks get a read-only token and cannot comment, so they are skipped. | |
| - name: Comment coverage delta | |
| continue-on-error: true | |
| if: >- | |
| github.event_name == 'pull_request' && | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.repository }} | |
| PR: ${{ github.event.pull_request.number }} | |
| MARKER: '<!-- coverage-history-comment -->' | |
| # Bound through the environment rather than expanded into the script: | |
| # a branch name can contain shell metacharacters. | |
| BASE_REF: ${{ github.base_ref }} | |
| run: | | |
| # The history lives on the coverage-history branch, not on main. Without | |
| # it compare falls back to absolute numbers, so a failed fetch is fine. | |
| git fetch --depth=1 origin coverage-history \ | |
| && git show FETCH_HEAD:history.csv > coverage-baseline.csv \ | |
| || echo "No coverage history available; reporting absolute numbers." | |
| python3 .github/scripts/coverage_history.py compare --suite unit \ | |
| --base "$BASE_REF" --csv coverage-baseline.csv --out coverage-comment.md | |
| # Reuse the existing comment if this workflow already posted one. | |
| ID=$(gh api "repos/$REPO/issues/$PR/comments" --paginate \ | |
| --jq "[.[] | select(.body | startswith(\"$MARKER\"))] | first | .id // empty") | |
| if [ -n "$ID" ]; then | |
| gh api --method PATCH "repos/$REPO/issues/comments/$ID" \ | |
| -F body=@coverage-comment.md | |
| else | |
| gh api --method POST "repos/$REPO/issues/$PR/comments" \ | |
| -F body=@coverage-comment.md | |
| fi | |
| - name: Upload build reports | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: always() | |
| with: | |
| name: screenshot-report | |
| path: maps-app/build/reports |