125 lines
4.3 KiB
YAML
125 lines
4.3 KiB
YAML
name: Ego Browser Smoke
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
smoke_value:
|
|
description: Value to type into the form smoke field
|
|
required: false
|
|
default: CiSmoke42
|
|
type: string
|
|
run_screenshot:
|
|
description: Also run the chat-driven screenshot smoke
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
ego-browser-smoke:
|
|
name: Run ego-browser smoke suite
|
|
runs-on: [self-hosted, macOS]
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Verify runner prerequisites
|
|
run: |
|
|
set -euo pipefail
|
|
command -v ego-browser
|
|
command -v tesseract
|
|
python3 --version
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # 8.2.0
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: |
|
|
pyproject.toml
|
|
uv.lock
|
|
|
|
- name: Set up Python 3.11
|
|
run: uv python install 3.11
|
|
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/retry
|
|
with:
|
|
command: uv sync --locked --python 3.11 --extra all --extra dev
|
|
|
|
- name: Run unit + form smoke coverage
|
|
run: |
|
|
source .venv/bin/activate
|
|
python -m pytest tests/tools/test_ego_browser_smoke_utils.py tests/tools/test_ego_browser_smoke_scripts.py::test_form_smoke_script_round_trips_value -q
|
|
|
|
- name: Run form smoke script
|
|
run: |
|
|
source .venv/bin/activate
|
|
./scripts/ego_browser_form_smoke.sh "${{ inputs.smoke_value }}"
|
|
|
|
- name: Run screenshot smoke script
|
|
if: ${{ inputs.run_screenshot }}
|
|
env:
|
|
EGO_BROWSER_SCREENSHOT_RESULT_JSON: ${{ runner.temp }}/ego-browser-screenshot-result.json
|
|
run: |
|
|
source .venv/bin/activate
|
|
./scripts/ego_browser_screenshot_smoke.sh
|
|
|
|
- name: Upload screenshot artifact
|
|
if: ${{ inputs.run_screenshot && success() }}
|
|
run: |
|
|
python3 - <<'PY'
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
result_path = Path(os.environ['RESULT_JSON'])
|
|
payload = json.loads(result_path.read_text())
|
|
screenshot_path = Path(payload['screenshot_path'])
|
|
if not screenshot_path.exists():
|
|
raise SystemExit(f"Screenshot missing: {screenshot_path}")
|
|
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
fh.write(f"screenshot_path={screenshot_path}\n")
|
|
fh.write(f"result_json={result_path}\n")
|
|
fh.write(f"title={payload['title']}\n")
|
|
fh.write(f"page_url={payload['url']}\n")
|
|
fh.write(f"capture_method={payload['capture_method']}\n")
|
|
fh.write(f"ocr_text={payload['ocr_text']}\n")
|
|
PY
|
|
env:
|
|
RESULT_JSON: ${{ runner.temp }}/ego-browser-screenshot-result.json
|
|
id: screenshot_meta
|
|
|
|
- name: Upload screenshot files
|
|
if: ${{ inputs.run_screenshot && success() }}
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
id: screenshot_artifact
|
|
with:
|
|
name: ego-browser-screenshot-smoke
|
|
path: |
|
|
${{ steps.screenshot_meta.outputs.screenshot_path }}
|
|
${{ steps.screenshot_meta.outputs.result_json }}
|
|
retention-days: 7
|
|
|
|
- name: Write screenshot summary
|
|
if: ${{ inputs.run_screenshot && success() }}
|
|
env:
|
|
SUMMARY_TITLE: ${{ steps.screenshot_meta.outputs.title }}
|
|
SUMMARY_URL: ${{ steps.screenshot_meta.outputs.page_url }}
|
|
SUMMARY_CAPTURE_METHOD: ${{ steps.screenshot_meta.outputs.capture_method }}
|
|
SUMMARY_SCREENSHOT_PATH: ${{ steps.screenshot_meta.outputs.screenshot_path }}
|
|
SUMMARY_OCR_TEXT: ${{ steps.screenshot_meta.outputs.ocr_text }}
|
|
run: |
|
|
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
|
|
## Ego-browser screenshot smoke
|
|
|
|
- Artifact: ego-browser-screenshot-smoke
|
|
- Title: $SUMMARY_TITLE
|
|
- URL: $SUMMARY_URL
|
|
- Capture method: $SUMMARY_CAPTURE_METHOD
|
|
- Screenshot path: $SUMMARY_SCREENSHOT_PATH
|
|
- OCR text: $SUMMARY_OCR_TEXT
|
|
EOF
|