feat(screenshot): report theme changes instead of writing them back #3992
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: Performance Tests | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| paths: | |
| # Only run on code changes that could affect performance | |
| - 'src/**' | |
| - 'tests/src/e2e/performance/**' | |
| - 'tests/src/e2e/utilities/performance.py' | |
| - '.github/workflows/performance-tests.yml' | |
| pull_request: | |
| branches: [ master ] | |
| paths: | |
| - 'src/**' | |
| - 'tests/src/e2e/performance/**' | |
| - 'tests/src/e2e/utilities/performance.py' | |
| - '.github/workflows/performance-tests.yml' | |
| workflow_dispatch: | |
| # Run weekly to catch performance regressions | |
| schedule: | |
| - cron: '0 6 * * 1' # Every Monday at 6 AM UTC | |
| permissions: | |
| contents: read | |
| env: | |
| PYTHON_VERSION: "3.13" | |
| UV_CACHE_DIR: /tmp/.uv-cache | |
| # renovate: datasource=docker depName=ghcr.io/home-assistant/home-assistant | |
| HA_IMAGE_GHCR: "ghcr.io/home-assistant/home-assistant:2026.8.0" | |
| # Disable Testcontainers' Ryuk reaper: it has been reported to leave | |
| # zombie containers on GHA runners (see #366, Ilya0527 2026-05-18). | |
| # The E2E fixture in tests/src/e2e/conftest.py relies instead on the | |
| # enclosing ``with container:`` context manager — Python guarantees | |
| # its ``__exit__`` fires on both normal and exception flows, so the | |
| # Ryuk safety net is not needed for deterministic cleanup. Refs #366. | |
| TESTCONTAINERS_RYUK_DISABLED: "true" | |
| jobs: | |
| performance-tests: | |
| name: Performance Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| persist-credentials: false | |
| - name: Cache HA Docker image | |
| id: cache-ha-image | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 | |
| with: | |
| path: /tmp/ha-image.tar | |
| key: ha-image-${{ env.HA_IMAGE_GHCR }}-${{ runner.arch }} | |
| - name: Load cached HA image | |
| if: steps.cache-ha-image.outputs.cache-hit == 'true' | |
| run: docker load -i /tmp/ha-image.tar | |
| - name: Pull HA image (GHCR → Docker Hub fallback) | |
| if: steps.cache-ha-image.outputs.cache-hit != 'true' | |
| run: | | |
| HA_VERSION="${HA_IMAGE_GHCR##*:}" | |
| HA_IMAGE_DOCKERHUB="homeassistant/home-assistant:${HA_VERSION}" | |
| for registry in "$HA_IMAGE_GHCR" "$HA_IMAGE_DOCKERHUB"; do | |
| echo "Trying $registry..." | |
| if docker pull "$registry"; then | |
| if [ "$registry" != "$HA_IMAGE_GHCR" ]; then | |
| docker tag "$registry" "$HA_IMAGE_GHCR" | |
| fi | |
| docker save "$HA_IMAGE_GHCR" -o /tmp/ha-image.tar | |
| echo "Pulled and cached from $registry" | |
| exit 0 | |
| fi | |
| done | |
| echo "Failed to pull from any registry" | |
| exit 1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run performance tests | |
| id: perf_tests | |
| run: | | |
| echo "Running performance tests..." | |
| uv run pytest tests/src/e2e/performance/ \ | |
| -v \ | |
| --tb=short \ | |
| -m performance \ | |
| --log-cli-level=INFO \ | |
| 2>&1 | tee performance_output.txt | |
| # Capture exit code | |
| exit_code=${PIPESTATUS[0]} | |
| echo "exit_code=$exit_code" >> $GITHUB_OUTPUT | |
| exit $exit_code | |
| env: | |
| HAMCP_ENV_FILE: "tests/.env.test" | |
| - name: Upload performance results | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: performance-results | |
| path: performance_output.txt | |
| retention-days: 30 | |
| - name: Performance summary | |
| if: always() | |
| run: | | |
| echo "## Performance Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.perf_tests.outputs.exit_code }}" = "0" ]; then | |
| echo ":white_check_mark: **All performance tests passed**" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo ":x: **Some performance tests failed**" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Timing Results" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| grep -E "(avg=|p95=|SLOW|target)" performance_output.txt | head -30 >> $GITHUB_STEP_SUMMARY || echo "No timing data found" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY |