Explorer: Stop the favorites tests flaking on a stale-cache race #337
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
| name: Code tests & eval | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint-vital: | |
| name: Lint vitals | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| flavor: [ Foss,Gplay ] | |
| variant: [ Beta,Release ] | |
| module: [ app ] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Setup project and build environment | |
| uses: ./.github/actions/common-setup | |
| - name: Check for fatal lint issues | |
| run: ./gradlew lintVital${{ matrix.flavor }}${{ matrix.variant }} | |
| build-modules: | |
| name: Build apps | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| flavor: [ Foss,Gplay ] | |
| variant: [ Debug ] | |
| module: [ app ] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Setup project and build environment | |
| uses: ./.github/actions/common-setup | |
| - name: Build modules | |
| run: ./gradlew ${{ matrix.module }}:assemble${{ matrix.flavor }}${{ matrix.variant }} | |
| test-modules: | |
| name: Unit tests | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| variant: [ Debug ] | |
| # Every module carries the `version` dimension, so there is no flavor-free | |
| # `testDebugUnitTest` task left to run; these two cover the whole tree. | |
| flavor: [ testFoss,testGplay ] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Setup project and build environment | |
| uses: ./.github/actions/common-setup | |
| - name: Test modules | |
| run: ./gradlew ${{ matrix.flavor }}${{ matrix.variant }}UnitTest | |
| - name: Verify Room schemas are committed | |
| run: | | |
| if [ -n "$(git status --porcelain -- '*/schemas/*')" ]; then | |
| git status --porcelain -- '*/schemas/*' | |
| echo "::error::Room schema changed without being committed. Bump the @Database version, commit the new schema JSON, and add a Migration to the database's MIGRATIONS list." | |
| exit 1 | |
| fi | |
| - name: Print test failures summary | |
| if: failure() | |
| run: | | |
| python3 << 'EOF' | |
| import xml.etree.ElementTree as ET | |
| import html | |
| import glob | |
| print() | |
| print("=" * 80) | |
| print("❌ FAILED TESTS SUMMARY") | |
| print("=" * 80) | |
| found = False | |
| suspect_suites = [] | |
| for xml_file in glob.glob("**/build/test-results/**/*.xml", recursive=True): | |
| try: | |
| tree = ET.parse(xml_file) | |
| except ET.ParseError: | |
| continue | |
| module = xml_file.split("/")[0] | |
| for testcase in tree.findall(".//testcase"): | |
| # <failure> = assertion failed, <error> = test blew up (exception, init failure) | |
| for kind, element in (("FAILURE", testcase.find("failure")), ("ERROR", testcase.find("error"))): | |
| if element is None: | |
| continue | |
| found = True | |
| classname = testcase.get("classname", "").split(".")[-1] | |
| testname = testcase.get("name", "unknown") | |
| message = html.unescape(element.get("message", "")[:200]) | |
| print() | |
| print(f"📍 {module} [{kind}]") | |
| print(f" {classname} > {testname}") | |
| print(f" {message}") | |
| for suite in tree.iter("testsuite"): | |
| def count(attr): | |
| try: | |
| return int(suite.get(attr, "0")) | |
| except ValueError: | |
| return 0 | |
| failures, errors, skipped = count("failures"), count("errors"), count("skipped") | |
| if errors or skipped: | |
| print() | |
| print(f"📊 {module} {suite.get('name', '?')}: " | |
| f"tests={count('tests')} failures={failures} errors={errors} skipped={skipped}") | |
| # Worker-death fingerprint: nothing failed, yet tests were skipped/errored out. | |
| if failures == 0 and skipped > 0: | |
| suspect_suites.append(f"{module} {suite.get('name', '?')} ({skipped} skipped)") | |
| if not found: | |
| print("No <failure>/<error> details found in XML reports.") | |
| print("If the Gradle output above mentions a worker 'finished with non-zero exit value'") | |
| print("or 'unexpected problem', the test JVM died - see the raw Gradle output and the") | |
| print("uploaded test-jvm-crash artifact (hs_err / heap dumps).") | |
| if suspect_suites and not found: | |
| print() | |
| print("⚠️ POSSIBLE TEST JVM WORKER DEATH - suites with skipped tests but zero failures:") | |
| for entry in suspect_suites: | |
| print(f" {entry}") | |
| print(" (legitimate assumption-based skips look the same, so cross-check the Gradle output)") | |
| print() | |
| print("=" * 80) | |
| EOF | |
| - name: Upload test results | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.flavor }}-${{ matrix.variant }} | |
| path: | | |
| **/build/test-results/**/*.xml | |
| **/build/reports/tests/**/* | |
| retention-days: 1 | |
| - name: Upload test JVM crash diagnostics | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1 | |
| if: failure() | |
| with: | |
| name: test-jvm-crash-${{ matrix.flavor }}-${{ matrix.variant }} | |
| path: | | |
| **/build/test-jvm-crash/** | |
| **/hs_err_pid*.log | |
| **/*.hprof | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| check-release-tooling: | |
| name: Release tooling | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install bats and shellcheck | |
| run: sudo apt-get update -q && sudo apt-get install -y bats shellcheck | |
| - name: Shellcheck bump.sh | |
| run: shellcheck tools/release/bump.sh | |
| - name: Run bump.sh unit tests | |
| run: bats tools/release/bump.bats | |
| - name: Live consistency check | |
| run: bash tools/release/bump.sh --mode=check |