mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
test: add preview regression gate
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
name: preview-regression
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: preview-regression-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: Detect changes
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 2
|
||||
outputs:
|
||||
preview: ${{ steps.filter.outputs.preview }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: dorny/paths-filter@v4
|
||||
id: filter
|
||||
with:
|
||||
token: ""
|
||||
filters: |
|
||||
preview:
|
||||
- "packages/core/**"
|
||||
- "packages/player/**"
|
||||
- "packages/studio/**"
|
||||
- "packages/cli/**"
|
||||
- "packages/producer/src/parity-harness.ts"
|
||||
- "packages/producer/src/parity-fixtures.ts"
|
||||
- "packages/producer/tests/parity/**"
|
||||
- "package.json"
|
||||
- "bun.lock"
|
||||
- ".github/workflows/preview-regression.yml"
|
||||
|
||||
preview-parity:
|
||||
name: Preview parity
|
||||
needs: changes
|
||||
if: needs.changes.outputs.preview == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- run: bun install --frozen-lockfile
|
||||
|
||||
- name: Build preview runtime
|
||||
run: bun run --cwd packages/core build:hyperframes-runtime
|
||||
|
||||
- name: Prepare parity fixtures
|
||||
run: bun run --cwd packages/producer parity:fixtures:ci
|
||||
|
||||
- name: Install ffmpeg
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends ffmpeg
|
||||
ffmpeg -version | head -n 1
|
||||
|
||||
- name: Set up Chrome
|
||||
id: setup-chrome
|
||||
uses: browser-actions/setup-chrome@v1
|
||||
with:
|
||||
chrome-version: stable
|
||||
|
||||
- name: Start parity fixture server
|
||||
run: |
|
||||
cd packages/producer/tests/parity/fixtures
|
||||
python3 -m http.server 4173 --bind 127.0.0.1 > /tmp/preview-parity-http.log 2>&1 &
|
||||
echo "$!" > /tmp/preview-parity-http.pid
|
||||
for _ in $(seq 1 30); do
|
||||
if curl -fsS http://127.0.0.1:4173/minimal-wysiwyg.html >/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
cat /tmp/preview-parity-http.log
|
||||
exit 1
|
||||
|
||||
- name: Run preview parity check
|
||||
working-directory: packages/producer
|
||||
env:
|
||||
PUPPETEER_EXECUTABLE_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
|
||||
run: bun run parity:check:ci
|
||||
|
||||
- name: Upload parity artifacts
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: preview-parity-artifacts
|
||||
path: packages/producer/.debug/parity-harness-ci/
|
||||
if-no-files-found: ignore
|
||||
retention-days: 30
|
||||
|
||||
preview-regression:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changes, preview-parity]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Check results
|
||||
env:
|
||||
PREVIEW_FILTER_RESULT: ${{ needs.changes.outputs.preview }}
|
||||
PREVIEW_PARITY_RESULT: ${{ needs.preview-parity.result }}
|
||||
run: |
|
||||
{
|
||||
echo "## Preview regression gate"
|
||||
echo ""
|
||||
echo "- paths-filter \`preview\` matched: \`${PREVIEW_FILTER_RESULT}\`"
|
||||
echo "- preview-parity result: \`${PREVIEW_PARITY_RESULT}\`"
|
||||
echo ""
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
if [ "${PREVIEW_FILTER_RESULT}" != "true" ]; then
|
||||
echo "::notice title=Preview regression::SKIPPED — no preview/runtime changes. Auto-pass."
|
||||
echo "**Status:** SKIPPED (no preview/runtime changes — auto-pass)" >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${PREVIEW_PARITY_RESULT}" != "success" ]; then
|
||||
echo "**Status:** FAILED" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "Preview parity check failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "**Status:** PASSED" >> "$GITHUB_STEP_SUMMARY"
|
||||
Reference in New Issue
Block a user